package com.zhongshengnetwork.rightbe.lang.activity;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
//import android.databinding.DataBindingUtil;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.LinkAddress;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
//import android.support.annotation.NonNull;
//import android.support.annotation.Nullable;
//import android.support.v4.app.FragmentActivity;
//import android.support.v4.content.ContextCompat;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.transition.Transition;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.fastjson.JSONObject;
import com.bumptech.glide.Glide;
//import com.bumptech.glide.load.resource.drawable.GlideDrawable;
//import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.request.FutureTarget;
import com.bumptech.glide.request.target.SimpleTarget;

import com.bumptech.glide.request.target.Target;
import com.google.gson.Gson;
import com.tencent.mm.opensdk.modelmsg.WXImageObject;
import com.zhongshengnetwork.rightbe.Adv.model.AdvertUtils;
import com.zhongshengnetwork.rightbe.Adv.model.SPManageUtils;
import com.zhongshengnetwork.rightbe.commentstore.activity.CommentHomeActivity;
import com.zhongshengnetwork.rightbe.commentstore.model.CommentStoreModel;
import com.zhongshengnetwork.rightbe.common.AppThemeUtils;
import com.zhongshengnetwork.rightbe.common.Des;
import com.zhongshengnetwork.rightbe.common.GlideRoundTransform;
import com.zhongshengnetwork.rightbe.common.activity.AppBaseActivity;
import com.zhongshengnetwork.rightbe.common.loading.KyLoadingBuilder;
import com.zhongshengnetwork.rightbe.imageviewer.ImageLoader;
import com.zhongshengnetwork.rightbe.imageviewer.ViewData;
import com.zhongshengnetwork.rightbe.imageviewer.listener.OnItemLongClickListener;
import com.zhongshengnetwork.rightbe.imageviewer.widget.ImageViewer;
import com.pj.core.datamodel.DataWrapper;
import com.pj.core.http.HttpImage;
import com.pj.core.managers.LogManager;
import com.pj.core.utilities.ConvertUtility;
import com.pj.core.utilities.StringUtility;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
import com.scwang.smartrefresh.layout.footer.BallPulseFooter;
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
import com.scwang.smartrefresh.layout.header.BezierRadarHeader;
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.tencent.connect.common.Constants;
import com.tencent.connect.share.QQShare;
import com.tencent.connect.share.QzoneShare;
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import com.tencent.mm.opensdk.modelmsg.WXTextObject;
import com.tencent.mm.opensdk.modelmsg.WXWebpageObject;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.Tencent;
import com.tencent.tauth.UiError;
import com.wang.avi.AVLoadingIndicatorView;
import com.zhongshengnetwork.rightbe.Constant.APIKey;
import com.zhongshengnetwork.rightbe.Constant.Constant;
import com.zhongshengnetwork.rightbe.CustomApplication;
import com.zhongshengnetwork.rightbe.MainActivity;
import com.zhongshengnetwork.rightbe.R;
import com.zhongshengnetwork.rightbe.bindings.AttentionHeaderImageViewBinding;
import com.zhongshengnetwork.rightbe.bindings.CommonItemBinding;
import com.zhongshengnetwork.rightbe.common.BroadcastDefine;
import com.zhongshengnetwork.rightbe.common.CircleTransform;
import com.zhongshengnetwork.rightbe.common.CommonUtils;
import com.zhongshengnetwork.rightbe.common.DateUtil;
import com.zhongshengnetwork.rightbe.common.GsonTools;
import com.zhongshengnetwork.rightbe.common.HandlerDefine;
import com.zhongshengnetwork.rightbe.common.ScreenUtils;
import com.zhongshengnetwork.rightbe.common.TopBarView;
import com.zhongshengnetwork.rightbe.common.activity.ReportActivity;
import com.zhongshengnetwork.rightbe.common.customview.ActionSheetDialog;
import com.zhongshengnetwork.rightbe.common.customview.CustomDialog;
import com.zhongshengnetwork.rightbe.common.customview.KeyMapDailog;
import com.zhongshengnetwork.rightbe.common.customview.MyListView;
import com.zhongshengnetwork.rightbe.common.customview.PublishSelectPicPopupWindow;
import com.zhongshengnetwork.rightbe.common.customview.SelfListView;
import com.zhongshengnetwork.rightbe.common.customview.ShareDialog;
import com.zhongshengnetwork.rightbe.common.expandabletextview.ExpandableTextView;
import com.zhongshengnetwork.rightbe.common.pulluprefresh.xlistview.XListView;
import com.zhongshengnetwork.rightbe.common.utils.LangUtils;
import com.zhongshengnetwork.rightbe.common.utils.ToastUtil;
import com.zhongshengnetwork.rightbe.dbmodel.LogindbModel;
import com.zhongshengnetwork.rightbe.dbservice.LogindbService;
import com.zhongshengnetwork.rightbe.gsonmodel.CommonModel;
import com.zhongshengnetwork.rightbe.gsonmodel.DryCommentModel;
import com.zhongshengnetwork.rightbe.gsonmodel.LangInfoModel;
import com.zhongshengnetwork.rightbe.https.HttpCallBack;
import com.zhongshengnetwork.rightbe.https.HttpsUtils;
import com.zhongshengnetwork.rightbe.lang.res.Configs;
import com.zhongshengnetwork.rightbe.login.LoginActivity;
import com.zhongshengnetwork.rightbe.view.controller.CommonItemViewController;

import org.xutils.common.util.FileUtil;

import java.io.File;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.just.agentweb.BaseJsAccessEntrace.TAG;
import static com.zhongshengnetwork.rightbe.common.customview.KeyMapDailog.TextKey;

public class LangDetailActivity extends AppBaseActivity implements TopBarView.onTitleBarClickListener{

    private TopBarView topbar;
    //图片浏览
    public ImageViewer imagePreivew;
    private int imgW = 0;
    private int imgH = 0;
    private int imgFullWidth = 0;
    List<ViewData> mViewDatas = new ArrayList<ViewData>();
    List<Object> mImageList = new ArrayList<Object>();
    private String mSamllImg = "";
    //加载动画
    private AVLoadingIndicatorView avi;
    private LangInfoModel langInfoModel;
    //微信分享
    private List<String> nameList;
    private List<String> moreList;
    private PublishSelectPicPopupWindow menuWindow;
    public MyHandler myHandler;

    private Button lang_care;
    private TextView lang_share_text;
    private ImageView lang_collect_img;
    private TextView lang_collect_text;
    private ImageView lang_like_img;
    private TextView lang_like_text;
    private TextView lang_comment_text;

    //评论弹出框
    private KeyMapDailog dialog = null;
    private static final int Records = 20;
    private int pageIndex = 0;
    private List<DryCommentModel> list=null;
    private ListView listview;
    private MyAdapter adapter;

    private int opIndex = 0;
    private int shareType = 0; //0-朋友圈 1-微信 2-QQ 3-QQ空间 4-微博
    private boolean isShareWx = false;
    private ClipboardManager myClipboard;

    private RefreshLayout mRefreshLayout;

    private int roundCorner = 0;

    private View mAttentionGuysContainer;
    private TextView mAttentionGuyTitle;
    private ViewGroup mAttentionGuyIconsContainer;
    private View     mAttentionGuysMoreButton;

    private RelativeLayout wztcontent_layout;

    private String fileName = null;

    LinearLayout up_img_layout;
    ImageView up_img_1;
    FrameLayout up_img_1_layout;
    ImageView up_img_2;
    FrameLayout up_img_2_layout;
    ImageView up_img_3;
    FrameLayout up_img_3_layout;


    LinearLayout middle_img_layout;
    ImageView middle_img_1;
    FrameLayout middle_img_1_layout;
    ImageView middle_img_2;
    FrameLayout middle_img_2_layout;
    ImageView middle_img_3;
    FrameLayout middle_img_3_layout;

    LinearLayout down_img_layout;
    ImageView down_img_1;
    FrameLayout down_img_1_layout;
    ImageView down_img_2;
    FrameLayout down_img_2_layout;
    ImageView down_img_3;
    FrameLayout down_img_3_layout;

    private boolean isImgShare = false;

    private TextView lang_detail_comment_title;
    private boolean latestComment = false;

    //private static final String LangShareUrl = "https://app.daydayrise.net/rightbe/miniapp/langappid/sharelang.do?id=";
    //private static final String LangShareUrl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.zhongshengnetwork.rightbe";
    private static final String AppShareUrl = "http://a.app.qq.com/o/simple.jsp?pkgname=com.zhongshengnetwork.rightbe";

    private void showMenu(){

        List<String> orderList = new ArrayList<String>();
        orderList.add("最新评论");
        orderList.add("最热评论");
        ActionSheetDialog actionSheetDialog = new ActionSheetDialog(LangDetailActivity.this)
                .builder()
                .setTitle("请选择")
                .setCancelable(false)
                .setCanceledOnTouchOutside(true);
        for (String s : orderList){
            actionSheetDialog.addSheetItem(s, null, new ActionSheetDialog.OnSheetItemClickListener() {
                @Override
                public void onClick(int which) {
                    if (which == 1){
                        latestComment = false;
                        lang_detail_comment_title.setText("最新评论");
                        SPManageUtils.getInstance(CustomApplication.mContext).putSPInt(AdvertUtils.CommentOrderKey, 0);
                        getLatest();
                    }else if (which == 2){
                        latestComment = false;
                        lang_detail_comment_title.setText("最热评论");
                        SPManageUtils.getInstance(CustomApplication.mContext).putSPInt(AdvertUtils.CommentOrderKey, 1);
                        getLatest();
                    }
                }
            });
        }
        actionSheetDialog.show();
    }

    private MyIUiListener mIUiListener = new MyIUiListener();
    class MyIUiListener implements IUiListener {
        @Override
        public void onComplete(Object o) {
            //Log.e("TAG","分享成功");
            getShareGold();
        }

        @Override
        public void onError(UiError uiError) {
            Log.e("TAG","分享出错");
        }

        @Override
        public void onCancel() {
            Log.e("TAG","分享取消");
        }

        @Override
        public void onWarning(int i) {

        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            Tencent.onActivityResultData(requestCode, resultCode, data, mIUiListener);
            if (resultCode == Constants.REQUEST_QQ_SHARE || resultCode == Constants.REQUEST_QZONE_SHARE || resultCode == Constants.REQUEST_OLD_SHARE) {
                Tencent.handleResultData(data, mIUiListener);
            }
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        langInfoModel =  (LangInfoModel) getIntent().getSerializableExtra("model");
        langInfoModel.setMy(false);
        latestComment = getIntent().getBooleanExtra("latestComment", false);
        setContentView(R.layout.activity_lang_detail);
        topbar = (TopBarView)findViewById(R.id.topbar);
        topbar.getRightView().setVisibility(View.GONE);
        topbar.getRightView().setImageResource(R.drawable.more);
        topbar.getRightView().setClickable(true);
        topbar.getRightView().setVisibility(View.VISIBLE);
        topbar.getRightView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                langMore(v);
            }
        });
        topbar.setClickListener(this);
        topbar.getTitleView().setText(langInfoModel.getTypename());
        if (CommonUtils.isEmpty(langInfoModel.getTypename())){
            topbar.getTitleView().setText("微句");
        }
        topbar.getTitleView().setClickable(true);
        topbar.getTitleView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (list != null && list.size() > 0){
                    //listview.smoothScrollToPosition(0);
                    listview.setSelection(0);
                    //listview.scrollToPosition(0);
                }
            }
        });

        wztcontent_layout = (RelativeLayout) findViewById(R.id.langcontent_layout);
        wztcontent_layout.setBackgroundColor(AppThemeUtils.getInstance().getMainColor());
        LinearLayout lang_detail_bg = (LinearLayout) findViewById(R.id.lang_detail_bg);
        lang_detail_bg.setBackgroundColor(AppThemeUtils.getInstance().getMainColor());

        imagePreivew = (ImageViewer) findViewById(R.id.imagePreivew);
        avi = (AVLoadingIndicatorView)findViewById(R.id.avi);
        myClipboard = (ClipboardManager)getSystemService(CLIPBOARD_SERVICE);
        roundCorner = getResources().getDimensionPixelSize(R.dimen.image_round_corner);
        initData();
        //initLang();
        initComment();
        boolean share = getIntent().getBooleanExtra("share",false);
        if (share == true){
            onClickShare(null);
        }

        boolean copy = getIntent().getBooleanExtra("copy",false);
        if (copy == true){
            onClickCopy(langInfoModel.getTitle(), false);
        }

        myHandler = new MyHandler(LangDetailActivity.this);
        registerBoradcastReceiver();

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unregisterReceiver(mBroadcastReceiver);
    }

    /**
     * 点击了返回导航按钮
     */
    @Override
    public void onBackClick() {
        hintKeyBoard();
        finish();
        //Toast.makeText(LangDetailActivity.this, "你点击了左侧按钮", Toast.LENGTH_LONG).show();

    }

    /**
     * 点击了右边导航按钮
     */
    @Override
    public void onRightClick() {

    }

    public void hintKeyBoard() {
        //拿到InputMethodManager
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        //如果window上view获取焦点 && view不为空
        if (imm.isActive() && getCurrentFocus() != null) {
            //拿到view的token 不为空
            if (getCurrentFocus().getWindowToken() != null) {
                //表示软键盘窗口总是隐藏，除非开始时以SHOW_FORCED显示。
                imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }
    }

    /****************微句详情******************/

    //微句点击更多
    private void langMore(final View view){
        moreList.clear();
        if (CommonUtils.isLogin() == true){
            if (SPManageUtils.getInstance(CustomApplication.mContext).getSPBoolean(AdvertUtils.whiteKey, false) == true){
                moreList.add("评论库");
                moreList.add("提交一次性评论");
            }
        }
        moreList.add("分享");
        moreList.add("评论");
        if (langInfoModel.islike() == false){
            moreList.add("笔芯");
        }
        if (langInfoModel.iscollect() == false){
            moreList.add("收藏");
        }
        moreList.add("复制");
        moreList.add("举报");
        ActionSheetDialog actionSheetDialog = new ActionSheetDialog(LangDetailActivity.this)
                .builder()
                .setTitle("请选择")
                .setCancelable(false)
                .setCanceledOnTouchOutside(true);
        for (String s : moreList){
            actionSheetDialog.addSheetItem(s, null, new ActionSheetDialog.OnSheetItemClickListener() {
                @Override
                public void onClick(int which) {
                    if (which > 0){
                        String title = moreList.get(which-1);
                        if (title.equals("分享")){
                            onClickShare(view);
                        }else if (title.equals("评论")){
                            onClickComment();
                        }else if (title.equals("笔芯")){
                            onClickLike();
                        }else if (title.equals("收藏")){
                            onClickCollect();
                        }else if (title.equals("复制")){
                            if(CommonUtils.isLogin() == false){
                                Intent intent = new Intent(LangDetailActivity.this, LoginActivity.class);
                                startActivity(intent);
                                return;
                            }
                            onClickCopy(langInfoModel.getTitle(), false);
                        }else if (title.equals("举报")){
                            report(langInfoModel.getLangid(), 2);
                        }else if (title.equals("评论库")){

                            if(CommonUtils.isLogin() == false){
                                Intent intent = new Intent(LangDetailActivity.this, LoginActivity.class);
                                startActivity(intent);
                                return;
                            }

                            Intent intent = new Intent(LangDetailActivity.this, CommentHomeActivity.class);
                            Bundle bundle=new Bundle();
                            bundle.putSerializable("model", langInfoModel);//序列化
                            intent.putExtras(bundle);//发送数据
                            startActivity(intent);
                        }else if (title.equals("提交一次性评论")){
                            if(CommonUtils.isLogin() == false){
                                Intent intent = new Intent(LangDetailActivity.this, LoginActivity.class);
                                startActivity(intent);
                                return;
                            }
                            CommentStoreModel m = new CommentStoreModel();
                            m.setContent("");
                            m.setClassifyId(0);
                            m.setCommentId(0L);
                            showComment(m);
                        }
                    }
                }
            });
        }
        actionSheetDialog.show();
    }

    public void showComment(final CommentStoreModel model){
        SPManageUtils.getInstance(CustomApplication.mContext).putSPString(TextKey, model.getContent());

        if (CommonUtils.bindMobile(LangDetailActivity.this) == true){
            return;
        }

        dialog = new KeyMapDailog("提交一次性评论...", new KeyMapDailog.SendBackListener() {
            @Override
            public void sendBack(final String inputText) {
                if (inputText == null || inputText.length() == 0){
                    return;
                }
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        //dialog.hideProgressdialog();
                        dialog.dismiss();
                        new Thread(){
                            @Override
                            public void run() {
                                super.run();
                                final HashMap<String, String> map = new HashMap<String, String>();
                                map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
                                map.put("dataContent",inputText);
                                map.put("dataId",""+model.getCommentId());
                                map.put("dataSourceId",langInfoModel.getLangid());
                                String url = "comment/store/content/commit.do";
                                HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                                    @Override
                                    public void onSuccess(String data) {
                                        Log.e("TAG","评论结果："+data);
                                        final CommonModel commonModel = GsonTools.getCommonModel(data);
                                        if (commonModel.getFlag().equals("1")){
                                            runOnUiThread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    avi.hide();
                                                    ToastUtil.show(LangDetailActivity.this, "评论成功");

                                                }
                                            });
                                        }else {
                                            runOnUiThread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    avi.hide();
                                                    ToastUtil.show(LangDetailActivity.this, commonModel.getMsg());
                                                }
                                            });
                                        }
                                    }

                                    @Override
                                    public void onError(String msg) {
                                        runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                avi.hide();
                                                ToastUtil.show(LangDetailActivity.this, "提交失败");
                                            }
                                        });
                                    }
                                });
                            }
                        }.start();
                    }
                }, 5);
            }
        });
        dialog.show(getSupportFragmentManager(), "dialog");
    }

    private void onClickCopy(String text, boolean isShare){
        if(CommonUtils.isEmpty(text)){
            return;
        }

        if (langInfoModel.isOriginal() == true){
            ToastUtil.show(LangDetailActivity.this, "亲，原创内容不允许复制~");
            return;
        }

        if(CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this, LoginActivity.class);
            startActivity(intent);
            return;
        }

        if (isShare == false){
            if (!CommonUtils.isEmpty(text) && text.equals(langInfoModel.getTitle())){
                CommonUtils.copy(LangDetailActivity.this, text, langInfoModel.isOriginal(), langInfoModel.getLangid());
                return;
            }
        }

        try{
            ClipData myClip = ClipData.newPlainText("text", text);
            myClipboard.setPrimaryClip(myClip);
            if (isShare == true){
                Toast.makeText(getApplicationContext(), "文字已复制，分享启动中...",
                        Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(getApplicationContext(), "文字已复制~",
                        Toast.LENGTH_SHORT).show();
            }
        }catch (Exception e){

        }
    }

    private void initData(){
        if (nameList == null){
            nameList = new ArrayList<String>();
            nameList.add("分享给微信好友");
            nameList.add("分享到微信朋友圈");
            nameList.add("分享给QQ好友");
            nameList.add("分享到QQ空间");
            nameList.add("分享到微博");
        }
        if (moreList == null){
            moreList = new ArrayList<String>();
        }
        if (list == null){
            list = new ArrayList<DryCommentModel>();
        }
        calculateImageWidth();
    }

    private void calculateImageWidth(){
        int width = ScreenUtils.getScreenWidth(LangDetailActivity.this);
        int gap = getResources().getDimensionPixelSize(R.dimen.padding_5);
        int margin = getResources().getDimensionPixelSize(R.dimen.paddingLR);
        imgW = Math.round((float)(width - margin * 2 - 2 * gap) / 3.0f);
        imgFullWidth = width - margin * 2;
        imgH = Math.round(imgW / Configs.Value.IMAGE_WIDTH_HEIGHT_RATIO);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        calculateImageWidth();
        updateImg();
    }

    private void updateImg(){

        if (up_img_layout == null){
            return;
        }

        up_img_layout.setVisibility(View.GONE);
        middle_img_layout.setVisibility(View.GONE);
        down_img_layout.setVisibility(View.GONE);
        if (langInfoModel.getImglist() == null){

        }else if (langInfoModel.getImglist().size() == 1){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            if (langInfoModel.getScaleSize() > 0.05){
                if (langInfoModel.getScaleSize() > 1.0){
                    params.width = (int)(imgFullWidth*0.6);
                    params.height = (int)Math.round(imgFullWidth*0.6 * langInfoModel.getScaleSize());
                }else {
                    params.width = imgFullWidth;
                    int height = (int)Math.round(imgFullWidth * langInfoModel.getScaleSize());
                    params.height = height;
                }
                up_img_1.setLayoutParams(params);
                if (langInfoModel.getImglist().get(0).toLowerCase().contains(".gif")){//.dontAnimate()
                    try{
                        if (LangDetailActivity.this == null){
                            return;
                        }
                        Glide.with(LangDetailActivity.this).asGif().load(langInfoModel.getImglist().get(0)).
                                diskCacheStrategy(DiskCacheStrategy.RESOURCE).fitCenter().centerCrop().into(up_img_1);
                    }catch (Exception e){
                        LangPublishActivity.uploadError("微句详情加载gif图片报错："+e.getLocalizedMessage());
                    }
                }else {
                    try {
                        if (LangDetailActivity.this == null){
                            return;
                        }
                        Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)).dontAnimate().placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).error(AppThemeUtils.getInstance().getDefaultImageBg()) .transform(new CenterCrop(),new GlideRoundTransform(LangDetailActivity.this,Constant.LangCornerRadius)).into(up_img_1);
                    }catch (Exception e){
                        LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
                    }


                }
            }else {
                params.width = imgFullWidth;
                params.height = Math.round(imgFullWidth / Configs.Value.IMAGE_WIDTH_HEIGHT_RATIO);
                up_img_1.setLayoutParams(params);
                if (LangDetailActivity.this == null){
                    return;
                }
                HttpImage.getInstance(LangDetailActivity.this).setRoundedImage(
                        langInfoModel.getImglist().get(0),
                        up_img_1,
                        AppThemeUtils.getInstance().getDefaultImageBg(),
                        roundCorner
                );
            }

            up_img_2_layout.setVisibility(View.GONE);
            up_img_2.setVisibility(View.GONE);
            params = up_img_2.getLayoutParams();
            params.width =0;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            up_img_3.setVisibility(View.GONE);
            up_img_3_layout.setVisibility(View.GONE);
            params = up_img_3.getLayoutParams();
            params.width =0;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

        }else if (langInfoModel.getImglist().size() == 2){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.INVISIBLE);
            up_img_3_layout.setVisibility(View.INVISIBLE);

        }else if (langInfoModel.getImglist().size() == 3){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
        }else if (langInfoModel.getImglist().size() == 4){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_2.setVisibility(View.INVISIBLE);
            middle_img_2_layout.setVisibility(View.INVISIBLE);
            middle_img_3.setVisibility(View.INVISIBLE);
            middle_img_3_layout.setVisibility(View.INVISIBLE);

        }else if (langInfoModel.getImglist().size() == 5){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_2.setVisibility(View.VISIBLE);
            middle_img_2_layout.setVisibility(View.VISIBLE);
            middle_img_2_layout.setTag(0+",5");
            middle_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(4)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_3.setVisibility(View.INVISIBLE);
            middle_img_3_layout.setVisibility(View.INVISIBLE);

        }else if (langInfoModel.getImglist().size() == 6){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_2.setVisibility(View.VISIBLE);
            middle_img_2_layout.setVisibility(View.VISIBLE);
            middle_img_2_layout.setTag(0+",5");
            middle_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(4)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_3.setVisibility(View.VISIBLE);
            middle_img_3_layout.setVisibility(View.VISIBLE);
            middle_img_3_layout.setTag(0+",6");
            middle_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(5)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

        }else if (langInfoModel.getImglist().size() == 7){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            middle_img_2.setVisibility(View.VISIBLE);
            middle_img_2_layout.setVisibility(View.VISIBLE);
            middle_img_2_layout.setTag(0+",5");
            middle_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(4)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            middle_img_3.setVisibility(View.VISIBLE);
            middle_img_3_layout.setVisibility(View.VISIBLE);
            middle_img_3_layout.setTag(0+",6");
            middle_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(5)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            down_img_layout.setVisibility(View.VISIBLE);
            down_img_1.setVisibility(View.VISIBLE);
            down_img_1_layout.setVisibility(View.VISIBLE);
            down_img_1_layout.setTag(0+",7");
            down_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(6)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            down_img_2.setVisibility(View.INVISIBLE);
            down_img_2_layout.setVisibility(View.INVISIBLE);
            down_img_3.setVisibility(View.INVISIBLE);
            down_img_3_layout.setVisibility(View.INVISIBLE);
        }else if (langInfoModel.getImglist().size() == 8){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);
            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_2.setVisibility(View.VISIBLE);
            middle_img_2_layout.setVisibility(View.VISIBLE);
            middle_img_2_layout.setTag(0+",5");
            middle_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(4)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_3.setVisibility(View.VISIBLE);
            middle_img_3_layout.setVisibility(View.VISIBLE);
            middle_img_3_layout.setTag(0+",6");
            middle_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(5)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_layout.setVisibility(View.VISIBLE);
            down_img_1.setVisibility(View.VISIBLE);
            down_img_1_layout.setVisibility(View.VISIBLE);
            down_img_1_layout.setTag(0+",7");
            down_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(6)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_2.setVisibility(View.VISIBLE);
            down_img_2_layout.setVisibility(View.VISIBLE);
            down_img_2_layout.setTag(0+",8");
            down_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(7)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_3.setVisibility(View.INVISIBLE);
            down_img_3_layout.setVisibility(View.INVISIBLE);
        }else if (langInfoModel.getImglist().size() == 9){
            up_img_layout.setVisibility(View.VISIBLE);
            up_img_1.setVisibility(View.VISIBLE);
            up_img_1_layout.setVisibility(View.VISIBLE);
            up_img_1_layout.setTag(0+",1");
            up_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            ViewGroup.LayoutParams params = up_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(0)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_2.setVisibility(View.VISIBLE);
            up_img_2_layout.setVisibility(View.VISIBLE);
            up_img_2_layout.setTag(0+",2");
            up_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(1)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            up_img_3.setVisibility(View.VISIBLE);
            up_img_3_layout.setVisibility(View.VISIBLE);
            up_img_3_layout.setTag(0+",3");
            up_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = up_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            up_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(2)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(up_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_layout.setVisibility(View.VISIBLE);
            middle_img_1.setVisibility(View.VISIBLE);
            middle_img_1_layout.setVisibility(View.VISIBLE);
            middle_img_1_layout.setTag(0+",4");
            middle_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(3)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_2.setVisibility(View.VISIBLE);
            middle_img_2_layout.setVisibility(View.VISIBLE);
            middle_img_2_layout.setTag(0+",5");
            middle_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(4)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            middle_img_3.setVisibility(View.VISIBLE);
            middle_img_3_layout.setVisibility(View.VISIBLE);
            middle_img_3_layout.setTag(0+",6");
            middle_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = middle_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            middle_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(5)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(middle_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_layout.setVisibility(View.VISIBLE);
            down_img_1.setVisibility(View.VISIBLE);
            down_img_1_layout.setVisibility(View.VISIBLE);
            down_img_1_layout.setTag(0+",7");
            down_img_1_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_1.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_1.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(6)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_1);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_2.setVisibility(View.VISIBLE);
            down_img_2_layout.setVisibility(View.VISIBLE);
            down_img_2_layout.setTag(0+",8");
            down_img_2_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_2.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_2.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(7)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_2);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
            down_img_3.setVisibility(View.VISIBLE);
            down_img_3_layout.setVisibility(View.VISIBLE);
            down_img_3_layout.setTag(0+",9");
            down_img_3_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.e("TAG","点击了图片:"+v.getTag());
                    onClickImageView(v);
                }
            });
            params = down_img_3.getLayoutParams();
            params.width =imgW;
            params.height = imgW;
            down_img_3.setLayoutParams(params);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getImglist().get(8)+CommonUtils.formatString(langInfoModel.getImgEnd())).placeholder(AppThemeUtils.getInstance().getDefaultImageBg()).dontAnimate().into(down_img_3);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
        }
    }

    private void initLang(View view){

        lang_detail_comment_title = (TextView) view.findViewById(R.id.lang_detail_comment_title);
        int order = SPManageUtils.getInstance(CustomApplication.mContext).getSPInt(AdvertUtils.CommentOrderKey, 0);
        if (order == 0 || latestComment == true){
            lang_detail_comment_title.setText("最新评论");
        }else {
            lang_detail_comment_title.setText("最热评论");
        }
        LinearLayout lang_detail_menu_layout = (LinearLayout) view.findViewById(R.id.lang_detail_menu_layout);
        lang_detail_menu_layout.setClickable(true);
        lang_detail_menu_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                showMenu();
            }
        });

        ImageView lang_user_header = (ImageView) view.findViewById(R.id.lang_user_header);
        ImageView privateIcon = (ImageView) view.findViewById(R.id.private_icon);
        FrameLayout lang_user_header_layout = (FrameLayout) view.findViewById(R.id.lang_user_header_layout);
        lang_user_header_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickUser();
            }
        });

        ImageView lang_member_icon = (ImageView) view.findViewById(R.id.lang_member_icon);
        if (!CommonUtils.isEmpty(langInfoModel.getMemberIcon())){
            lang_member_icon.setVisibility(View.VISIBLE);
            try{
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getMemberIcon()).
                        diskCacheStrategy(DiskCacheStrategy.RESOURCE).fitCenter().centerCrop().into(lang_member_icon);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }

        }else {
            lang_member_icon.setVisibility(View.INVISIBLE);
        }

        TextView lang_user_nickname = (TextView) view.findViewById(R.id.lang_user_nickname);
        lang_user_nickname.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickUser();
            }
        });
        TextView lang_time = (TextView) view.findViewById(R.id.lang_time);
        lang_time.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        lang_care = (Button) view.findViewById(R.id.lang_care);
        lang_care.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickCare();
            }
        });
        ExpandableTextView lang_content = (ExpandableTextView) view.findViewById(R.id.lang_content);

        try {
            if (LangDetailActivity.this == null){
                return;
            }
            Glide.with(LangDetailActivity.this).load(langInfoModel.getHeader()).transform(new CircleTransform(LangDetailActivity.this)).dontAnimate().into(lang_user_header);
        }catch (Exception e){
            LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
        }
        if (!CommonUtils.isEmpty(langInfoModel.getPrivateIcon())){
            privateIcon.setVisibility(View.VISIBLE);

            try {
                if (LangDetailActivity.this == null){
                    return;
                }
                Glide.with(LangDetailActivity.this).load(langInfoModel.getPrivateIcon()).transform(new CircleTransform(LangDetailActivity.this)).dontAnimate().into(privateIcon);
            }catch (Exception e){
                LangPublishActivity.uploadError("微句详情加载图片报错："+e.getLocalizedMessage());
            }
        }else {
            privateIcon.setVisibility(View.GONE);
        }
        lang_user_nickname.setText(langInfoModel.getNickname());

        String timeStr = CommonUtils.getNewDateTime((long)langInfoModel.getCreatetime()*1000);
        if (langInfoModel.isOriginal() == true){
            if (!CommonUtils.isEmpty(langInfoModel.getSign())){
                lang_time.setText("原创 · "+"阅读量："+CommonUtils.getDisplayCount(langInfoModel.getExploreCount())+" · "+langInfoModel.getSign()+" · "+ timeStr);
            }else {
                lang_time.setText("原创 · "+"阅读量："+CommonUtils.getDisplayCount(langInfoModel.getExploreCount())+" · "+ timeStr);
            }
        }else {
            if (!CommonUtils.isEmpty(langInfoModel.getSign())){
                lang_time.setText("阅读量："+CommonUtils.getDisplayCount(langInfoModel.getExploreCount())+" · "+langInfoModel.getSign()+" · "+ timeStr);
            }else {
                lang_time.setText("阅读量："+CommonUtils.getDisplayCount(langInfoModel.getExploreCount())+" · "+ timeStr);
            }
        }

        if (langInfoModel.iscare() == true){
            lang_care.setVisibility(View.INVISIBLE);
        }else {
            lang_care.setVisibility(View.VISIBLE);
        }
        lang_content.setText(langInfoModel.getTitle());

        lang_user_nickname.setTextColor(AppThemeUtils.getInstance().getUserNameColorOfWeiJu());
        lang_content.mTvContent.setTextColor(AppThemeUtils.getInstance().getTextColorOfWeiJu());
        lang_content.setText(langInfoModel.getTitle(),0);
        lang_content.setOnExpandStateChangeListener(new ExpandableTextView.OnExpandStateChangeListener() {
            @Override
            public void onExpandStateChanged(TextView textView, boolean isExpanded) {

            }

            @Override
            public void onClickContentText(int position) {

            }

            @Override
            public void onLongPressContentText(int position) {
                  CommonUtils.copy(LangDetailActivity.this, langInfoModel.getTitle(), langInfoModel.isOriginal(), langInfoModel.getLangid());
            }

            @Override
            public void onDoubleContentText(int position) {
                onClickLike();
            }

        });

        LinearLayout lang_op_layout = (LinearLayout)view.findViewById(R.id.lang_op_layout);
        Button lang_op1 = (Button) view.findViewById(R.id.lang_op1);
        lang_op1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });

        lang_op_layout.setVisibility(View.GONE);
        lang_op1.setVisibility(View.GONE);

        up_img_layout = (LinearLayout) view.findViewById(R.id.up_img_layout);
        up_img_1 = (ImageView) view.findViewById(R.id.up_img_1);
        up_img_1_layout = (FrameLayout)view. findViewById(R.id.up_img_1_layout);
        up_img_2 = (ImageView) view.findViewById(R.id.up_img_2);
        up_img_2_layout = (FrameLayout) view.findViewById(R.id.up_img_2_layout);
        up_img_3 = (ImageView) view.findViewById(R.id.up_img_3);
        up_img_3_layout = (FrameLayout) view.findViewById(R.id.up_img_3_layout);


        middle_img_layout = (LinearLayout) view.findViewById(R.id.middle_img_layout);
        middle_img_1 = (ImageView) view.findViewById(R.id.middle_img_1);
        middle_img_1_layout = (FrameLayout) view.findViewById(R.id.middle_img_1_layout);
        middle_img_2 = (ImageView) view.findViewById(R.id.middle_img_2);
        middle_img_2_layout = (FrameLayout) view.findViewById(R.id.middle_img_2_layout);
        middle_img_3 = (ImageView) view.findViewById(R.id.middle_img_3);
        middle_img_3_layout = (FrameLayout) view.findViewById(R.id.middle_img_3_layout);

        down_img_layout = (LinearLayout) view.findViewById(R.id.down_img_layout);
        down_img_1 = (ImageView) view.findViewById(R.id.down_img_1);
        down_img_1_layout = (FrameLayout) view.findViewById(R.id.down_img_1_layout);
        down_img_2 = (ImageView) view.findViewById(R.id.down_img_2);
        down_img_2_layout = (FrameLayout) view.findViewById(R.id.down_img_2_layout);
        down_img_3 = (ImageView) view.findViewById(R.id.down_img_3);
        down_img_3_layout = (FrameLayout) view.findViewById(R.id.down_img_3_layout);

        updateImg();

        ImageView lang_share_img = (ImageView) view.findViewById(R.id.lang_share_img);
        lang_share_text = (TextView) view.findViewById(R.id.lang_share_text);
        lang_share_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        if (langInfoModel.getSharecount() < 1) {
            lang_share_text.setText("分享");
        } else {
            lang_share_text.setText(CommonUtils.getDisplayCount(langInfoModel.getSharecount()) + "");
        }

        lang_collect_img = (ImageView) view.findViewById(R.id.lang_collect_img);
        lang_collect_text = (TextView) view.findViewById(R.id.lang_collect_text);
        if (langInfoModel.iscollect() == true){
            lang_collect_img.setImageResource(R.drawable.collection_sel);
            lang_collect_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        }else {
            lang_collect_img.setImageResource(R.drawable.collection);
            lang_collect_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        }
        if (langInfoModel.getCollectcount() < 1) {
            lang_collect_text.setText("收藏");
        } else {
            lang_collect_text.setText(CommonUtils.getDisplayCount(langInfoModel.getCollectcount()));
        }

        lang_like_img = (ImageView) view.findViewById(R.id.lang_like_img);
        lang_like_text = (TextView) view.findViewById(R.id.lang_like_text);
        if (langInfoModel.islike() == true){
            lang_like_img.setImageResource(R.drawable.workgroup_img_like_sel);
            lang_like_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        }else {
            lang_like_img.setImageResource(R.drawable.workgroup_img_like);
            lang_like_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        }
        if (langInfoModel.getLikecount() < 1) {
            lang_like_text.setText(LangUtils.getDescriptionByLangType(langInfoModel.getType()));
        } else {
            lang_like_text.setText(CommonUtils.getDisplayCount(langInfoModel.getLikecount()) + "");
        }

        ImageView lang_share_comment = (ImageView) view.findViewById(R.id.lang_share_comment);
        lang_comment_text = (TextView) view.findViewById(R.id.lang_comment_text);
        lang_comment_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());

        if (langInfoModel.getCommentcount() < 1) {
            lang_comment_text.setText("评论");
        } else {
            lang_comment_text.setText(CommonUtils.getDisplayCount(langInfoModel.getCommentcount()) + "");
        }


        RelativeLayout lang_share = (RelativeLayout) view.findViewById(R.id.lang_share);
        lang_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickShare(v);
            }
        });

        RelativeLayout lang_collect = (RelativeLayout) view.findViewById(R.id.lang_collect);
        lang_collect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickCollect();
            }
        });

        RelativeLayout lang_like = (RelativeLayout) view.findViewById(R.id.lang_like);
        lang_like.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickLike();
            }
        });

        RelativeLayout lang_comment = (RelativeLayout)view.findViewById(R.id.lang_comment);
        lang_comment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickComment();
            }
        });

        // 底部common按钮
        findViewById(R.id.lang_detail_common_button).setBackgroundColor(AppThemeUtils.getInstance().getMainColor());
        findViewById(R.id.lang_detail_common_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onClickComment();
            }
        });

        View lang_detial_item_line_1 = (View)view.findViewById(R.id.lang_detial_item_line_1);
        lang_detial_item_line_1.setBackgroundColor(AppThemeUtils.getInstance().getBackgroundColor());

        RelativeLayout lang_detail_attention_layout = (RelativeLayout) view.findViewById(R.id.lang_detail_attention_layout);
        lang_detail_attention_layout.setBackgroundResource(AppThemeUtils.getInstance().getWeiJuLikeBackground());

        View lang_detail_gasline = (View)findViewById(R.id.lang_detail_gasline);
        lang_detail_gasline.setBackgroundColor(AppThemeUtils.getInstance().getBackgroundColor());
        LinearLayout detail_right = (LinearLayout) view.findViewById(R.id.detail_right);
        detail_right.setBackgroundColor(AppThemeUtils.getInstance().getBackgroundColor());
        LinearLayout detail_left = (LinearLayout) view.findViewById(R.id.detail_left);
        detail_left.setBackgroundColor(AppThemeUtils.getInstance().getBackgroundColor());

        if (mAttentionGuyIconsContainer == null){
            mAttentionGuysContainer = view.findViewById(R.id.lang_detail_attention_guys_container);
            mAttentionGuyIconsContainer = (ViewGroup)view.findViewById(R.id.lang_detail_attention_guys);
            mAttentionGuyTitle = (TextView)view.findViewById(R.id.lang_detail_attention_title);
            mAttentionGuysMoreButton = view.findViewById(R.id.lang_detail_attention_guys_more);
            mAttentionGuysMoreButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mAttentionGuyTitle != null){
                        Intent intent = new Intent(LangDetailActivity.this, FansActivity.class);
                        intent.putExtra(TopBarView.KEY_TITLE, mAttentionGuyTitle.getText());
                        intent.putExtra(FansActivity.KEY_USER_ID, langInfoModel.getUserid());
                        intent.putExtra(FansActivity.KEY_SOURCE_ID, langInfoModel.getLangid());
                        startActivity(intent);
                    }

                }
            });
            // 先隐藏
            mAttentionGuysContainer.setVisibility(View.GONE);
            requestAttentionGuys(langInfoModel);
        }
    }

    public boolean isMainThread() {
        return Looper.getMainLooper().getThread() == Thread.currentThread();
    }

    public void updateUI(){
        if (isMainThread() == true){
            updateContent();
            return;
        }
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                updateContent();
            }
        });
    }

    private void updateContent(){
        if (lang_care == null || lang_share_text == null || lang_collect_img == null
                || lang_collect_text == null || lang_like_img == null
                || lang_like_text == null || lang_comment_text == null){
            return;
        }

        if (langInfoModel.iscare() == true){
            lang_care.setVisibility(View.INVISIBLE);
        }else {
            lang_care.setVisibility(View.VISIBLE);
        }

        if (langInfoModel.getSharecount() < 1) {
            lang_share_text.setText("分享");
        } else {
            lang_share_text.setText(langInfoModel.getSharecount() + "");
        }

        if (langInfoModel.iscollect() == true){
            lang_collect_img.setImageResource(R.drawable.collection_sel);
            lang_collect_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        }else {
            lang_collect_img.setImageResource(R.drawable.collection);
            lang_collect_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        }
        if (langInfoModel.getCollectcount() < 1) {
            lang_collect_text.setText("收藏");
        } else {
            lang_collect_text.setText(langInfoModel.getCollectcount() + "");
        }

        if (langInfoModel.islike() == true){
            lang_like_img.setImageResource(R.drawable.workgroup_img_like_sel);
            lang_like_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        }else {
            lang_like_img.setImageResource(R.drawable.workgroup_img_like);
            lang_like_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
        }
        if (langInfoModel.getLikecount() < 1) {
            lang_like_text.setText(LangUtils.getDescriptionByLangType(langInfoModel.getType()));
        } else {
            lang_like_text.setText(langInfoModel.getLikecount() + "");
        }

        if (langInfoModel.getCommentcount() < 1) {
            lang_comment_text.setText("评论");
        } else {
            lang_comment_text.setText(langInfoModel.getCommentcount() + "");
        }
    }

    public void requestAttentionGuys(final LangInfoModel infoModel) {
        if (infoModel == null || !CommonUtils.isLogin()) {
            return;
        }
        final LogindbModel model = CustomApplication.loginModel;
        if (model == null) {
            return;
        }
        if (!StringUtility.equals(model.getUid(), infoModel.getUserid())) {
            return;
        }

        new Thread(){
            @Override
            public void run() {
                super.run();
                int gap = getResources().getDimensionPixelSize(R.dimen.lang_detail_attention_guys_icon_gap);
                int size = getResources().getDimensionPixelSize(R.dimen.lang_detail_attention_guys_icon_size);
                int screenWidth = ScreenUtils.getScreenWidth(getApplicationContext());
                int margin = getResources().getDimensionPixelSize(R.dimen.lang_paddingLR);
                int moreButtonSize = getResources().getDimensionPixelSize(R.dimen.lang_detail_attention_more_button_width);
                int width = screenWidth - margin * 2 - moreButtonSize - gap * 2;
                int maxCount = Math.round((float)width / (float) (gap * 2 + size));
                final int resizedSize = width / maxCount - gap * 2;
                final HashMap<String, String> map = new HashMap<String, String>();
                map.put(APIKey.tokenKey, model.getToken());
                map.put("sourceid", langInfoModel.getLangid());
                map.put("type","0");
                map.put("pageindex","0");
                map.put("pagerecords",Integer.toString(maxCount));
                String url = "miniapp/langappid/getlanguser.do";
                HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                    @Override
                    public void onSuccess(String data) {
                        LogManager.d("Detail", "requestAttentionGuys success:%s", data);
                        CommonModel commonModel = GsonTools.getCommonModel(data);
                        if (commonModel.getFlag().equals("1") && commonModel.getData() != null && commonModel.getData() instanceof List){

                            List<Map<String, Object>> list = (List<Map<String, Object>>) commonModel.getData();
                            updateAttentionList(list, resizedSize);
                        }
                    }

                    @Override
                    public void onError(String msg) {
                        LogManager.d("Detail", "requestAttentionGuys error:%s", msg);
                    }
                });
            }
        }.start();

    }

    private void updateAttentionList(final List<Map<String, Object>> list, final int preferSize) {

        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (list != null && list.size() > 0) {
                    if(mAttentionGuysContainer == null || mAttentionGuyIconsContainer == null){
                        return;
                    }
                    mAttentionGuysContainer.setVisibility(View.VISIBLE);
                    mAttentionGuyIconsContainer.removeAllViews();
                    final String headerKey = "header";
                    final int bindingTag = R.layout.attention_header_image_view_layout;
                    final View.OnClickListener clickHeadListener = new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Map<String,Object> userData = (Map<String, Object>) v.getTag(bindingTag);
                            if (userData != null) {
                                //进入个人主页
                                DataWrapper wrapper = new DataWrapper();
                                wrapper.putAll(userData);
                                Intent intent = new Intent(LangDetailActivity.this, UserLangActivity.class);
                                intent.putExtra(APIKey.useridKey,wrapper.getString("userid"));
                                intent.putExtra(APIKey.typeKey,1);
                                intent.putExtra(APIKey.titleKey,wrapper.getString("nickname"));
                                startActivity(intent);
                            }
                        }
                    };
                    for (Map<String, Object> entry : list) {
                        AttentionHeaderImageViewBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.attention_header_image_view_layout, mAttentionGuyIconsContainer, true);
                        ViewGroup.LayoutParams params = binding.attentionImageView.getLayoutParams();
                        params.width = preferSize;
                        params.height = preferSize;
                        HttpImage.getInstance(LangDetailActivity.this).setCircleImage(StringUtility.toString(entry.get(headerKey)), binding.attentionImageView, R.drawable.bg_transparent);
                        if (entry.containsKey("privateIcon")){
                            if (entry.get("privateIcon") != null) {
                                String privateIcon = StringUtility.toString(entry.get("privateIcon"));
                                if (!CommonUtils.isEmpty(privateIcon)){
                                    HttpImage.getInstance(LangDetailActivity.this).setCircleImage(privateIcon, binding.privateIcon, R.drawable.bg_transparent);
                                }else {
                                    binding.privateIcon.setVisibility(View.GONE);
                                }
                            }
                        }else {
                            binding.privateIcon.setVisibility(View.GONE);
                        }
                        binding.getRoot().setClickable(true);
                        binding.getRoot().setTag(bindingTag, entry);
                        binding.getRoot().setOnClickListener(clickHeadListener);
                    }
                    mAttentionGuyTitle.setText(getResources().getString(R.string.lang_detail_attention_title, langInfoModel.getLikecount(), LangUtils.getDescriptionByLangType(langInfoModel.getType())));
                    mAttentionGuysMoreButton.setVisibility(langInfoModel.getLikecount() > list.size() ? View.VISIBLE : View.GONE);
                }
            }
        });
    }

    static class MyHandler extends Handler {

        WeakReference<LangDetailActivity> mWeakReference;
        public MyHandler(LangDetailActivity activity)
        {
            mWeakReference = new WeakReference<LangDetailActivity>(activity);
        }
        //子类重写次方法，处理消息
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);

            if(mWeakReference == null){
                return;
            }
            final LangDetailActivity activity = mWeakReference.get();
            if (activity == null){
                return;
            }

            try{
                if (msg == null || msg.obj == null || msg.obj.toString() == null){
                    return;
                }
                if (msg.obj.toString().equals(HandlerDefine.wx_share_result)){
                    final HashMap<String, String> map = new HashMap<String, String>();
                    map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
                    map.put("id", activity.langInfoModel.getLangid());
                    String url = "miniapp/"+"langappid"+"/sharelanginfo.do";
                    HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                        @Override
                        public void onSuccess(String data) {
                            activity.avi.hide();
                            CommonModel commonModel = GsonTools.getCommonModel(data);
                            if (commonModel.getFlag().equals("1")){
                                activity.langInfoModel.setSharecount(activity.langInfoModel.getSharecount()+1);
                            }else {
                                CustomApplication.showTip(commonModel, activity);
                            }
                        }

                        @Override
                        public void onError(String msg) {
                            activity.avi.hide();
                        }
                    });
                }
            }catch (Exception e){
                LangPublishActivity.uploadError("分享报错："+CommonUtils.formatString(e.getMessage()));
            }
        }
    }

    private void getShareGold(){
        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("id", langInfoModel.getLangid());
        if(isImgShare == true){
            map.put("type", "1");
        }
        String url = "miniapp/"+"langappid"+"/sharelanginfo.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(final String data) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        avi.hide();
                        final CommonModel commonModel = GsonTools.getCommonModel(data);
                        if (commonModel.getFlag().equals("1")){
                            langInfoModel.setSharecount(langInfoModel.getSharecount()+1);
                            new Handler().postDelayed(new Runnable(){
                                public void run() {
                                    lang_share_text.setText(langInfoModel.getSharecount()+"");
                                }
                            }, 10);
                        }else {
                            CustomApplication.showTip(commonModel, LangDetailActivity.this);
                        }
                    }
                });
            }

            @Override
            public void onError(String msg) {
                avi.hide();
            }
        });
    }

    /**
     * 广播接收者
     * @author Gordon
     */
    private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver(){
        @Override
        public void onReceive(Context context, Intent intent) {
            System.out.print("onReceive接收到广播了" + "\n");
            String action = intent.getAction();
            if (action.equals(BroadcastDefine.WX_Share_Result)){

                //这个方法分享无效
//                Message msg = new Message();
//                msg.obj = new String(HandlerDefine.wx_share_result);
//                myHandler.sendMessage(msg);
                getShareGold();
            }
        }
    };
    /**
     * 注册广播
     * @author Gordon
     */
    public void registerBoradcastReceiver(){
        IntentFilter myIntentFilter = new IntentFilter();
        //添加接收广播类型
        myIntentFilter.addAction(BroadcastDefine.WX_Share_Result);
        //注册广播
        registerReceiver(mBroadcastReceiver, myIntentFilter);
    }

    //分享文字到微信
    private void shareToWX(int type, String title){

        WXTextObject textObject = new WXTextObject();
        textObject.text = title;

        WXMediaMessage msg = new WXMediaMessage();
        msg.mediaObject = textObject;
        msg.description = title;

        SendMessageToWX.Req req = new SendMessageToWX.Req();
        req.transaction = buildTransaction("text");
        req.message = msg;
        req.scene = type==0 ? SendMessageToWX.Req.WXSceneTimeline:SendMessageToWX.Req.WXSceneSession;
        CustomApplication.mWxApi.sendReq(req);

    }

    //分享链接到微信
    private void shareLinkToWX(int type,String url,String title,String content, Bitmap bmp){
        //初始化一个WXWebpageObject对象，填写url
        WXWebpageObject webpage = new WXWebpageObject();
        webpage.webpageUrl = url;
        //用WXWebpageObject对象初始化一个WXMediaMessage对象，填写标题、描述
        WXMediaMessage msg = new WXMediaMessage(webpage);
        msg.title = title;
        msg.description = content;
        if (bmp == null){
            Bitmap thumb = BitmapFactory.decodeResource(getResources(),R.mipmap.icon);
            msg.thumbData = CommonUtils.bitmapToByteArray(thumb,true);
        }else {
            msg.thumbData = CommonUtils.bitmapToByteArray(bmp,true);
        }
        //构成一个Req
        SendMessageToWX.Req req = new SendMessageToWX.Req();
        req.message = msg;
        req.scene = type==0 ? SendMessageToWX.Req.WXSceneTimeline:SendMessageToWX.Req.WXSceneSession;
        CustomApplication.mWxApi.sendReq(req);

    }

    //分享图片到微信
    private void shareImg2Wx(int type, String title, Bitmap bitmap){

        bitmap = CommonUtils.getZoomImage(bitmap,2048);//官方说最大10M，实际达不到，为了保险起见，限制2M
        WXImageObject imgObj = new WXImageObject(bitmap);
        WXMediaMessage msg = new WXMediaMessage();
        msg.mediaObject = imgObj;
        msg.description = CommonUtils.formatString(title);
        msg.title = CommonUtils.formatString(title);
        //设置缩略图
        Bitmap thumbBmp = CommonUtils.getZoomImage(bitmap,24);//最大32k
        bitmap.recycle();
        msg.thumbData = CommonUtils.bitmapToBytes(thumbBmp);//Util.bmpToByteArray(thumbBmp, true);

        SendMessageToWX.Req req = new SendMessageToWX.Req();
        req.transaction = buildTransaction("img");
        req.message = msg;
        req.scene = type==0 ? SendMessageToWX.Req.WXSceneTimeline:SendMessageToWX.Req.WXSceneSession;
        CustomApplication.mWxApi.sendReq(req);
    }

    private String buildTransaction(final String type) {
        return (type == null) ? String.valueOf(System.currentTimeMillis()) : type + System.currentTimeMillis();
    }

    //点击头像和昵称
    private void onClickUser(){
        //进入个人主页
        Intent intent = new Intent(LangDetailActivity.this, UserLangActivity.class);
        intent.putExtra(APIKey.useridKey,langInfoModel.getUserid());
        intent.putExtra(APIKey.typeKey,1);
        intent.putExtra(APIKey.titleKey,langInfoModel.getNickname());
        startActivity(intent);
    }

    //点击关注
    private void onClickCare(){
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        langInfoModel.setIscare(true);
        lang_care.setVisibility(View.INVISIBLE);
        ToastUtil.show(LangDetailActivity.this, "已添加关注");
        adapter.notifyDataSetChanged();
        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("authorid", langInfoModel.getUserid());
        String url = "miniapp/"+"langappid"+"/addcare.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //点击了分享
    private void onClickShare(View v){


        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this, LoginActivity.class);
            startActivity(intent);
            return;
        }

        if(langInfoModel.getStatus() == 4){
            ToastUtil.show(LangDetailActivity.this,"私密微句不允许分享~");
            return;
        }

        shareType = 1;

        if (langInfoModel.getVisiblelevel() == 0){//审核不通过，只允许复制文字
            onClickCopy(langInfoModel.getTitle(), false);
            return;
        }

        if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
            shareText();
            return;
        }

        isImgShare = false;

        if (langInfoModel.isOriginal() == true || langInfoModel.getTitle().length() <= 300){//原创内容只能图文分享
            isImgShare = true;
            Intent intent = new Intent(LangDetailActivity.this, ShareActivity.class);
            Bundle bundle=new Bundle();
            bundle.putSerializable("model", langInfoModel);//序列化
            intent.putExtras(bundle);//发送数据
            startActivity(intent);
            return;
        }

        /*
        if (langInfoModel.getTitle().length() <= 200){//langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0 &&
            final List<String> menu = new ArrayList<String>();
            menu.add("分享图文");
            menu.add("分享文字");
            ActionSheetDialog actionSheetDialog = new ActionSheetDialog(LangDetailActivity.this)
                    .builder()
                    .setTitle("")
                    .setCancelable(false)
                    .setCanceledOnTouchOutside(true);
            for (String m : menu){
                actionSheetDialog.addSheetItem(m, null, new ActionSheetDialog.OnSheetItemClickListener() {
                    @Override
                    public void onClick(int which) {
                        if (which == 1){
                            isImgShare = true;
                            Intent intent = new Intent(LangDetailActivity.this, ShareActivity.class);
                            Bundle bundle=new Bundle();
                            bundle.putSerializable("model", langInfoModel);//序列化
                            intent.putExtras(bundle);//发送数据
                            startActivity(intent);
                        }else if (which == 2){
                            shareText();
                        }
                    }
                });
            }
            actionSheetDialog.show();
            return;
        }
        */

        shareText();

    }

    private void shareText(){
        final ShareDialog shareDialog = new ShareDialog(LangDetailActivity.this)
                .builder()
                .setCancelable(false)
                .setCanceledOnTouchOutside(true);
        shareDialog.friend_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //分享到朋友圈
                /*
                if (langInfoModel.getType() == 21){
                    //话题
                    if (langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                        isShareWx = false;
                        new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                    }else {
                        shareLinkToWX(0,AppShareUrl,langInfoModel.getTitle(),langInfoModel.getTypename(),null);
                    }
                }else {
                    shareToWX(0,langInfoModel.getTitle());
                }
                */
                if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
                    shareType = 0;
                    isShareWx = false;
                    onClickCopy(langInfoModel.getTitle(), true);
                    new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                }else {
                    shareToWX(0,langInfoModel.getTitle());
                }

            }
        });
        shareDialog.wx_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                /*
                //分享给微信好友
                if (langInfoModel.getType() == 21){
                    //话题
                    if (langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                        isShareWx = true;
                        new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                    }else {
                        shareLinkToWX(1,AppShareUrl,langInfoModel.getTitle(),"微句-言微句美，发现共鸣",null);
                    }
                }else {
                    shareToWX(1,langInfoModel.getTitle());
                }
                */
                if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
                    shareType = 1;
                    isShareWx = true;
                    onClickCopy(langInfoModel.getTitle(), true);
                    new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                }else {
                    shareToWX(1,langInfoModel.getTitle());
                }

            }
        });
        shareDialog.wb_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
                    shareType = 4;
                    new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                }else {
                    if (langInfoModel.getType() == 21){
                        //话题
                        CustomApplication.WbShareType = 0;
                        CustomApplication.WbShareSourceId = langInfoModel.getLangid();
                        CustomApplication.WbShareTitle = "微句-言微句美，发现共鸣";
                        CustomApplication.WbShareText = langInfoModel.getTitle();
                        CustomApplication.WbShareActionUrl = AppShareUrl;//LangShareUrl+langInfoModel.getLangid();
                        Intent mIntent = new Intent(BroadcastDefine.WeiBo_Share_Action);
                        //发送广播
                        sendBroadcast(mIntent);
                    }else {
                        //微博
                        CustomApplication.WbShareType = 1;
                        CustomApplication.WbShareSourceId = langInfoModel.getLangid();
                        CustomApplication.WbShareText = langInfoModel.getTitle();
                        Intent mIntent = new Intent(BroadcastDefine.WeiBo_Share_Action);
                        //发送广播
                        sendBroadcast(mIntent);
                    }
                }

            }
        });
        shareDialog.qq_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //分享到qq
                if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
                    shareType = 2;
                    //new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                    onClickCopy(langInfoModel.getTitle(), true);
                    download(langInfoModel.getImglist().get(0));
                }else {
                    if (langInfoModel.getType() == 21){
                        //话题
                        shareToQQ(2,langInfoModel.getTitle(),"微句-言微句美，发现共鸣");
                    }else {
                        shareToQQ(0,langInfoModel.getTitle(),"微句-言微句美，发现共鸣");
                    }
                }

            }
        });
        shareDialog.zone_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //qq空间
                if ((!CommonUtils.isEmpty(langInfoModel.getTypename()) && langInfoModel.getTypename().contains("文案")) || (langInfoModel.getScaleSize() > 0.05)){
                    shareType = 3;
                    onClickCopy(langInfoModel.getTitle(), true);
                    download(langInfoModel.getImglist().get(0));
                    //new getImageCacheAsyncTask(LangDetailActivity.this).execute(langInfoModel.getImglist().get(0));
                }else {
                    if (langInfoModel.getType() == 21){
                        //话题
                        shareToQQ(3,langInfoModel.getTitle(),"微句-言微句美，发现共鸣");
                    }else {
                        shareToQQ(1,langInfoModel.getTitle(),"微句-言微句美，发现共鸣");
                    }
                }

            }
        });
        shareDialog.show();
    }

    //分享到qq
    private Bundle params;
    private void shareToQQ(int type,String title,String content){
        params = new Bundle();
        if (type == 0){//分享给QQ好友
            params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
            params.putString(QQShare.SHARE_TO_QQ_TITLE, title);// 标题
            params.putString(QQShare.SHARE_TO_QQ_SUMMARY, content);// 摘要
            //params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,"http://a.app.qq.com/o/simple.jsp?pkgname=com.zhongshengnetwork.rightbe");// 内容地址
            params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
            if(langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL,langInfoModel.getImglist().get(0));// 网络图片地址
            }else {
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL,"http://image.daydayrise.net/360@2x.png");// 网络图片地址
            }
            params.putString(QQShare.SHARE_TO_QQ_EXT_INT, "");//其它附加功能
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    CustomApplication.mTencent.shareToQQ(LangDetailActivity.this, params, mIUiListener);
                }
            });
        }else if(type == 1){
            //分享到QQ空间
            params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE,QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
            params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);// 标题
            params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, content);// 摘要
            //params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL,"http://a.app.qq.com/o/simple.jsp?pkgname=com.zhongshengnetwork.rightbe");// 内容地址
            params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
            ArrayList<String> imgUrlList = new ArrayList<>();
            if(langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                imgUrlList.add(langInfoModel.getImglist().get(0));
            }else {
                imgUrlList.add("http://image.daydayrise.net/360@2x.png");
            }
            params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL,imgUrlList);// 图片地址
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    CustomApplication.mTencent.shareToQzone(LangDetailActivity.this, params, mIUiListener);
                }
            });
        }else if (type == 2){
            //分享链接到QQ
            params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT);
            params.putString(QQShare.SHARE_TO_QQ_TITLE, title);// 标题
            params.putString(QQShare.SHARE_TO_QQ_SUMMARY, content);// 摘要
            params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
            if(langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL,langInfoModel.getImglist().get(0));// 网络图片地址
            }else {
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL,"http://image.daydayrise.net/360@2x.png");// 网络图片地址
            }
            params.putString(QQShare.SHARE_TO_QQ_EXT_INT, "");//其它附加功能
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    CustomApplication.mTencent.shareToQQ(LangDetailActivity.this, params, mIUiListener);
                }
            });
        }else if (type == 3){
            //分享链接到QQ空间
            params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE,QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);
            params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title);// 标题
            params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, content);// 摘要
            params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
            ArrayList<String> imgUrlList = new ArrayList<>();
            if(langInfoModel.getImglist() != null && langInfoModel.getImglist().size() > 0){
                imgUrlList.add(langInfoModel.getImglist().get(0));
            }else {
                imgUrlList.add("http://image.daydayrise.net/360@2x.png");
            }
            params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL,imgUrlList);// 图片地址
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    CustomApplication.mTencent.shareToQzone(LangDetailActivity.this, params, mIUiListener);
                }
            });
        }

    }

    private void shareImgToQQ(int type,String title, Bitmap bitmap, String localPath){
        if (bitmap == null){
            return;
        }
        params = new Bundle();
        if (type == 0){//分享给QQ好友

            if (!CommonUtils.isEmpty(localPath)){
                params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE);
                //params.putString(QQShare.SHARE_TO_QQ_TITLE, title);// 标题
                //params.putString(QQShare.SHARE_TO_QQ_SUMMARY, title);// 摘要
                //params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, localPath);
                params.putString(QQShare.SHARE_TO_QQ_EXT_INT, "");//其它附加功能
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        CustomApplication.mTencent.shareToQQ(LangDetailActivity.this, params, mIUiListener);
                        //CommonUtils.deleteFileByPath(localPath);
                    }
                });
            }

        }else if(type == 1){
            //分享到QQ空间
            if (!CommonUtils.isEmpty(localPath)){//(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT)
                /*
                params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE);
                //params.putString(QQShare.SHARE_TO_QQ_TITLE, title);// 标题
                //params.putString(QQShare.SHARE_TO_QQ_SUMMARY, title);// 摘要
                //params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, localPath);
                params.putString(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN+"");//其它附加功能
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        CustomApplication.mTencent.shareToQzone(LangDetailActivity.this, params, mIUiListener);
                        //CommonUtils.deleteFileByPath(localPath);
                    }
                });
                */
                params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE);
                //params.putString(QQShare.SHARE_TO_QQ_TITLE, title);// 标题
                //params.putString(QQShare.SHARE_TO_QQ_SUMMARY, title);// 摘要
                //params.putString(QQShare.SHARE_TO_QQ_TARGET_URL,AppShareUrl);// 内容地址LangShareUrl+langInfoModel.getLangid()
                params.putString(QQShare.SHARE_TO_QQ_IMAGE_LOCAL_URL, localPath);
                params.putInt(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN);//其它附加功能
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        CustomApplication.mTencent.shareToQQ(LangDetailActivity.this, params, mIUiListener);
                        //CommonUtils.deleteFileByPath(localPath);
                    }
                });

                /*
                Tencent tencent = Tencent.createInstance("1105905402", CustomApplication.mContext); //要向腾讯平台申请appid
                Bundle bundle = new Bundle();
                bundle.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_IMAGE); //注意，要向qq空间分享纯图片，只能传这三个参数，不能传其他的
                bundle.putString(QQShare.SHARE_TO_QQ_IMAGE_URL,localPath); //localImgUrl必须是本地手机图片地址
                bundle.putInt(QQShare.SHARE_TO_QQ_EXT_INT, QQShare.SHARE_TO_QQ_FLAG_QZONE_AUTO_OPEN);
                tencent.shareToQQ(LangDetailActivity.this, bundle, null);
                */

            }
        }
    }

    //笔芯了收藏
    private void onClickCollect(){

        if(langInfoModel.getStatus() == 4){
            ToastUtil.show(LangDetailActivity.this,"私密微句不允许收藏~");
            return;
        }

        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        if (langInfoModel.iscollect() == true){
            langInfoModel.setIscollect(false);
            if (langInfoModel.getCollectcount() > 0){
                langInfoModel.setCollectcount(langInfoModel.getCollectcount()-1);
            }
            lang_collect_img.setImageResource(R.drawable.collection);
            lang_collect_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
            lang_collect_text.setText(langInfoModel.getCollectcount()+"");
            //updateUI();
            adapter.notifyDataSetChanged();
            final HashMap<String, String> map = new HashMap<String, String>();
            map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
            map.put("id", langInfoModel.getLangid());
            String url = "miniapp/"+"langappid"+"/cancleCollect.do";
            HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                @Override
                public void onSuccess(String data) {
                    Log.e("TAG","笔芯结果："+data);
                }

                @Override
                public void onError(String msg) {
                }
            });
            return;
        }
        langInfoModel.setIscollect(true);
        langInfoModel.setCollectcount(langInfoModel.getCollectcount()+1);
        lang_collect_img.setImageResource(R.drawable.collection_sel);
        lang_collect_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        lang_collect_text.setText(langInfoModel.getCollectcount()+"");
        //updateUI();
        adapter.notifyDataSetChanged();

        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("sourceid", langInfoModel.getLangid());
        map.put(APIKey.typeKey,"1");
        String url = "miniapp/"+"langappid"+"/addcollection.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
                Log.e("TAG","收藏结果："+data);
                //langInfoModel.setCollectcount(langInfoModel.getCollectcount() + 1);
               // initLang();
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //点击了笔芯
    private void onClickLike(){
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        if (langInfoModel.islike() == true){
            Log.e("TAG","已经笔芯过了");
            langInfoModel.setIslike(false);
            if (langInfoModel.getLikecount() > 0){
                langInfoModel.setLikecount(langInfoModel.getLikecount()-1);
            }
            lang_like_img.setImageResource(R.drawable.workgroup_img_like);
            lang_like_text.setTextColor(AppThemeUtils.getInstance().getSmallTextColor());
            lang_like_text.setText(langInfoModel.getLikecount()+"");
            adapter.notifyDataSetChanged();
            final HashMap<String, String> map = new HashMap<String, String>();
            map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
            map.put("id", langInfoModel.getLangid());
            String url = "miniapp/"+"langappid"+"/canclelike.do";
            HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                @Override
                public void onSuccess(String data) {
                    Log.e("TAG","笔芯结果："+data);
                }

                @Override
                public void onError(String msg) {
                }
            });
            return;
        }
        langInfoModel.setIslike(true);
        langInfoModel.setLikecount(langInfoModel.getLikecount()+1);
        lang_like_img.setImageResource(R.drawable.workgroup_img_like_sel);
        lang_like_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
        lang_like_text.setText(langInfoModel.getLikecount()+"");
        adapter.notifyDataSetChanged();

        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("id", langInfoModel.getLangid());
        map.put(APIKey.typeKey,"1");
        map.put("answerid","0");
        String url = "miniapp/"+"langappid"+"/langcl.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
                Log.e("TAG","笔芯结果："+data);
                //initLang();
                updateUI();
                requestAttentionGuys(langInfoModel);
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //点击了评论
    private void onClickComment(){
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        if (CommonUtils.bindMobile(LangDetailActivity.this) == true){
            return;
        }
        dialog = new KeyMapDailog("发表评论...", new KeyMapDailog.SendBackListener() {
            @Override
            public void sendBack(final String inputText) {
                if (inputText == null || inputText.length() == 0){
                    return;
                }
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        //dialog.hideProgressdialog();
                        dialog.dismiss();
                        avi.show();
                        //hintKeyBoard();

                        new Thread(){
                            @Override
                            public void run() {
                                super.run();
                                final HashMap<String, String> map = new HashMap<String, String>();
                                map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
                                map.put("id", langInfoModel.getLangid());
                                map.put("uid","");
                                map.put(APIKey.typeKey,"0");
                                map.put(APIKey.contentKey,inputText);
                                map.put("answerid","0");
                                String url = "miniapp/"+"langappid"+"/langcl.do";
                                HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                                    @Override
                                    public void onSuccess(String data) {
                                        //Log.e("TAG","评论结果："+data);
                                        final CommonModel commonModel = GsonTools.getCommonModel(data);
                                        if (commonModel.getFlag().equals("1")){
                                            runOnUiThread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    avi.hide();
                                                    ToastUtil.show(LangDetailActivity.this, "评论成功");
                                                    DryCommentModel dryCommentModel = new DryCommentModel();
                                                    dryCommentModel.setContent(inputText);
                                                    dryCommentModel.setUserid(CustomApplication.loginModel.getUid());
                                                    dryCommentModel.setHeader(CustomApplication.loginModel.getHeader());
                                                    dryCommentModel.setNickname(CustomApplication.loginModel.getNickname());
                                                    dryCommentModel.setTime(System.currentTimeMillis()+"");
                                                    dryCommentModel.setCcount("0");
                                                    dryCommentModel.setLcount("0");
                                                    dryCommentModel.setIslike("0");
                                                    dryCommentModel.setSharecount("0");
                                                    dryCommentModel.setCollectcount("0");
                                                    dryCommentModel.setIscollect("0");
                                                    dryCommentModel.setType("0");
                                                    dryCommentModel.setSourceid(langInfoModel.getLangid());
                                                    dryCommentModel.setCommentid(commonModel.getData()+"");
                                                    double v = Double.valueOf(dryCommentModel.getCommentid());
                                                    int n = (int)v;
                                                    dryCommentModel.setCommentid(n+"");
                                                    Log.e("TAG","评论id"+commonModel.getData());
                                                    list.add(0,dryCommentModel);
                                                    //adapter.notifyDataSetChanged();
                                                    //adapter.notifyItemInserted(0);
                                                    adapter.notifyDataSetChanged();
                                                    if (list.size() > 1){
                                                        listview.setSelection(0);
                                                    }
                                                    langInfoModel.setCommentcount(langInfoModel.getCommentcount() + 1);
                                                    //initLang();
                                                    updateUI();
                                                }
                                            });
                                        }else {
                                            runOnUiThread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    avi.hide();
                                                    ToastUtil.show(LangDetailActivity.this, "提交失败");
                                                }
                                            });
                                        }
                                    }

                                    @Override
                                    public void onError(String msg) {
                                        runOnUiThread(new Runnable() {
                                            @Override
                                            public void run() {
                                                avi.hide();
                                                ToastUtil.show(LangDetailActivity.this, "提交失败");
                                            }
                                        });
                                    }
                                });
                            }
                        }.start();
                    }
                }, 5);
            }
        });
        dialog.show(getSupportFragmentManager(), "dialog");
    }

    //点击图片处理
    private void onClickImageView(final View view){

        if (langInfoModel.getImglist() == null || langInfoModel.getImglist().size() ==0){
            return;
        }

        if (langInfoModel.getImglist().get(0).toLowerCase().contains(".gif") == true){
            return;//gif图片不允许放大
        }


        String tag = view.getTag().toString();
        final List<String> l = CommonUtils.stringToArrayList(tag);
        if (l == null || l.size() == 0){
            return;
        }

        if (CustomApplication.isWatchingImg == true){
            return;
        }
        CustomApplication.isWatchingImg = true;

        mSamllImg = langInfoModel.getImgEnd();
        int position = Integer.valueOf(l.get(1))-1;
        Log.e("TAG","当前位置："+position);
        Intent intent = new Intent(LangDetailActivity.this, SelfImagePreviewActivity.class);
        intent.putExtra("position",position);
        intent.putExtra("isListImg",true);
        intent.putExtra("imgs",langInfoModel.getImg());
        //View代表方法传入的控件
        int[] viewLocation = new int[2];
        view.getLocationInWindow(viewLocation);
        int viewX = viewLocation[0]; // x 坐标
        int viewY = viewLocation[1]-(int) (20*ScreenUtils.getScreenDensity(CustomApplication.mContext)); // y 坐标，这里当顶部有状态栏时，要减去状态栏的高度
        intent.putExtra("viewX",viewX);
        intent.putExtra("viewY",viewY);

        if (langInfoModel.getImglist().size() == 1){
            intent.putExtra("imgW",imgFullWidth);
            intent.putExtra("imgH",Math.round(imgFullWidth / Configs.Value.IMAGE_WIDTH_HEIGHT_RATIO));
        }else {
            intent.putExtra("imgW",imgW);
            intent.putExtra("imgH",imgW);
        }

        startActivity(intent);
        overridePendingTransition(0,0);//可以通过参数设置关闭与要显示的动画效果,0表示无效果.

    }


    /****************微句详情******************/

    
    

    /****************评论******************/

    private void  initComment(){

        listview = (ListView) findViewById(R.id.lang_listview);
        adapter = new MyAdapter();
        listview.setAdapter(adapter);

        //这里一定不能漏掉
//        listview.setPullLoadEnable(false);
//        listview.setPullRefreshEnable(true);
        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.e("TAG","position="+position);
                if (list == null || list.size() == 0){
                    return;
                }
                int index = position - 1;
                while (index < 0){//解决部分手机点击第一条不是从1开始的问题
                    index+=1;
                }
                commentMore(index);
            }
        });

        mRefreshLayout = (RefreshLayout)findViewById(R.id.refreshLayout);
        //设置 Header 为 贝塞尔雷达 样式
        mRefreshLayout.setRefreshHeader(new BezierRadarHeader(LangDetailActivity.this).setEnableHorizontalDrag(true));//BezierRadarHeader
        //设置 Footer 为 球脉冲 样式
        mRefreshLayout.setRefreshFooter(new ClassicsFooter(LangDetailActivity.this).setSpinnerStyle(SpinnerStyle.FixedBehind));//BallPulseFooter ClassicsFooter
        mRefreshLayout.setPrimaryColors(AppThemeUtils.getInstance().getRefreshBackgroundColor(),AppThemeUtils.getInstance().getRefreshAccessColor());
        mRefreshLayout.setEnableRefresh(true);//启用刷新
        mRefreshLayout.setEnableLoadMore(false);//启用加载
        //刷新
        mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshlayout) {
                //refreshlayout.finishRefresh();
                getLatest();
            }
        });
        mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
                //refreshLayout.finishLoadMore();
                loadMore();
            }
        });

        listview.setBackgroundColor(AppThemeUtils.getInstance().getMainColor());
        //listview.setDivider(new ColorDrawable(AppThemeUtils.getInstance().getBackgroundColor()));
        //listview.setDividerHeight((int)(1*ScreenUtils.getScreenDensity(CustomApplication.mContext)));

        getLatest();
    }

    private void getLatest(){
        new Thread(){
            @Override
            public void run() {
                super.run();
                pageIndex = 0;
                final Map<String,String> map = new HashMap<String, String>();
                map.put("pageIndex",pageIndex+"");
                map.put("pageRecord",Records+"");
                map.put(APIKey.idKey,langInfoModel.getLangid());
                if (CommonUtils.isLogin() == true){
                    map.put("token",CustomApplication.loginModel.getToken());
                }
                int order = SPManageUtils.getInstance(CustomApplication.mContext).getSPInt(AdvertUtils.CommentOrderKey, 0);
                if (order == 0 || latestComment == true){
                    map.put("type", "0");
                }else {
                    map.put("type", "1");
                }
                String url = "miniapp/"+"langappid"+"/v2langcommentlist.do";
                HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
                    @Override
                    public void onSuccess(String data) {
                        Log.e("TAG","评论内容："+data);
                        final CommonModel commonModel = GsonTools.getCommonModel(data);
                        if (commonModel.getFlag().equals("1")){
                            final List<DryCommentModel> l = GsonTools.getDryCommentModel1(data);
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    if (l != null && l.size() > 0){
                                        //pageIndex += 1;
                                        list.clear();
                                        Log.e("TAG","评论内容大小="+l.size());
                                        if (l.size() > 10){
                                            //listview.setPullLoadEnable(true);
                                            mRefreshLayout.setEnableLoadMore(true);
                                        }else {
                                            //listview.setPullLoadEnable(false);
                                            mRefreshLayout.setEnableLoadMore(false);
                                        }
                                        list.addAll(l);
                                    }else {
                                        //listview.setPullLoadEnable(false);
                                        mRefreshLayout.setEnableLoadMore(false);
                                    }
                                    //listview.stopRefresh(true);
                                    mRefreshLayout.finishRefresh();
                                    adapter.notifyDataSetChanged();
                                    pageIndex += 1;
                                }
                            });
                        }else {
                            runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    //listview.stopRefresh(true);
                                    mRefreshLayout.finishRefresh();
                                    CustomApplication.showTip(commonModel, LangDetailActivity.this);
                                }
                            });

                        }
                    }

                    @Override
                    public void onError(String msg) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                //listview.stopRefresh(true);
                                mRefreshLayout.finishRefresh();
                            }
                        });
                    }
                });
            }
        }.start();
        requestAttentionGuys(langInfoModel);
    }

    private void loadMore(){

        new Thread(){
            @Override
            public void run() {
                super.run();
                final Map<String,String> map = new HashMap<String, String>();
                map.put("pageIndex",pageIndex+"");
                map.put("pageRecord",Records+"");
                map.put(APIKey.idKey,langInfoModel.getLangid());
                if (CommonUtils.isLogin() == true){
                    map.put("token",CustomApplication.loginModel.getToken());
                }
                int order = SPManageUtils.getInstance(CustomApplication.mContext).getSPInt(AdvertUtils.CommentOrderKey, 0);
                if (order == 0 || latestComment == true){
                    map.put("type", "0");
                }else {
                    map.put("type", "1");
                }
                String url = "miniapp/"+"langappid"+"/v2langcommentlist.do";
                HttpsUtils.miniAppDo(map, url,  new HttpCallBack() {
                    @Override
                    public void onSuccess(String data) {
                        //listview.stopLoadMore();
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mRefreshLayout.finishLoadMore();
                                CommonModel commonModel = GsonTools.getCommonModel(data);
                                if (commonModel.getFlag().equals("1")){
                                    pageIndex += 1;
                                    List<DryCommentModel> l = GsonTools.getDryCommentModel1(data);
                                    int fromposition = list.size();
                                    if (l != null && l.size() > 0){
                                        if (l.size() > 0){
                                            //listview.setPullLoadEnable(true);
                                            mRefreshLayout.setEnableLoadMore(true);
                                        }else {
                                            //listview.setPullLoadEnable(false);
                                            mRefreshLayout.setEnableLoadMore(false);
                                        }
                                        list.addAll(l);
                                    }else {
                                        ToastUtil.show(LangDetailActivity.this, "亲，我是有底线的~");
                                        //listview.setPullLoadEnable(false);
                                        mRefreshLayout.setEnableLoadMore(false);
                                    }
                                    if (l != null){
                                        //adapter.notifyItemRangeChanged(fromposition, l.size());
                                        adapter.notifyDataSetChanged();
                                    }
                                }else {
                                    CustomApplication.showTip(commonModel, LangDetailActivity.this);
                                }
                            }
                        });
                    }

                    @Override
                    public void onError(String msg) {
                        //listview.stopLoadMore();
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mRefreshLayout.finishLoadMore();
                            }
                        });
                    }
                });
            }
        }.start();
    }

    private class MyAdapter extends BaseAdapter implements CommonItemViewController.EventDispatcher {

        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return list.size() + 1;
        }


        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return list.get(position-1);
        }

        @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        @Override
        public boolean isEnabled(int position) {
            // TODO Auto-generated method stub
            return super.isEnabled(position);
        }

        @Override
        public int getViewTypeCount() {
            return 2;
        }

        @Override
        public int getItemViewType(int position) {
            if (position == 0){
                return 0;
            }
            return 1;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            //convertView的复用
            int type = getItemViewType(position);
            if (type == 0){
                View view = null;
                if (convertView == null){
                    view = View.inflate(LangDetailActivity.this, R.layout.lang_header_layout,null);
                }else {
                    view = convertView;
                }
                initLang(view);
                LinearLayout langheader_layout = (LinearLayout) view.findViewById(R.id.langheader_layout);
                langheader_layout.setBackgroundColor(AppThemeUtils.getInstance().getMainColor());
                return view;
            }
            CommonItemViewController controller = null;
            if (convertView != null) {
                controller = (CommonItemViewController) convertView.getTag(R.layout.drycomment_listview_item);
            }
            if (controller == null) {
                controller = new CommonItemViewController(LangDetailActivity.this, R.layout.drycomment_listview_item, parent);
                controller.getBinding().getRoot().setTag(R.layout.drycomment_listview_item, controller);
            }
            position -= 1;
            DryCommentModel model = list.get(position);
            controller.setModel(model, position, this);
            TextView content = controller.getBinding().drycommentListviewItemContent;
            content.setClickable(true);
            content.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    int index = (int)view.getTag();
                    commentMore(index);
                }
            });

            TextView time = controller.getBinding().drycommentListviewItemTime;
            TextView reply_text = controller.getBinding().replyText;
            reply_text.setText("回复");
            String s1 = DateUtil.getChatDate(Long.valueOf(model.getTime()))+"";
            if (langInfoModel.getUserid().equals(model.getUserid())){
                time.setText("作者  ·  "+s1);
            }
            TextView replycount_text = controller.getBinding().replycountText;
            replycount_text.setTag(position);
            int count = Integer.valueOf(model.getCcount());// + model.getReplycount();
            if (count > 0){
                replycount_text.setVisibility(View.VISIBLE);
                replycount_text.setText("查看"+count+"条回复 >");
            }else {
                replycount_text.setVisibility(View.INVISIBLE);
            }
            replycount_text.setClickable(true);
            replycount_text.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    commentReply((int)view.getTag(), false);
                }
            });

            ImageView lang_member_icon = controller.getBinding().langMemberIcon;
            if (!CommonUtils.isEmpty(model.getMemberIcon())){
                lang_member_icon.setVisibility(View.VISIBLE);
                if (LangDetailActivity.this != null){
                    try{
                        Glide.with(LangDetailActivity.this).load(model.getMemberIcon()).
                                diskCacheStrategy(DiskCacheStrategy.RESOURCE).fitCenter().centerCrop().into(lang_member_icon);
                    }catch (Exception e){
                        LangPublishActivity.uploadError("每日推荐加载图片报错："+e.getLocalizedMessage());
                    }
                }
            }else {
                lang_member_icon.setVisibility(View.INVISIBLE);
            }

            return controller.getBinding().getRoot();
        }

        @Override
        public void onComment(Integer index) {
            commentUser(index);
        }

        @Override
        public void onMoreAction(Integer index) {
            commentMore(index);
        }

        @Override
        public void onReplay(Integer index) {
            commentReply(index, true);
        }

        @Override
        public void onActionLike(Integer index) {
            commentLike(index);
        }

        @Override
        public void onActionCollect(Integer index) {
            commentCollect(index);
        }
    }

    //点击了评论用户
    private void commentUser(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        final DryCommentModel model = list.get(index);
        //进入个人主页
        Intent intent = new Intent(LangDetailActivity.this, UserLangActivity.class);
        intent.putExtra(APIKey.useridKey,model.getUserid());
        intent.putExtra(APIKey.typeKey,1);
        intent.putExtra(APIKey.titleKey,model.getNickname());
        startActivity(intent);
    }

    //评论点击更多
    private void commentMore(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        final DryCommentModel model = list.get(index);
        shareType = 0;
        opIndex = index;
        moreList.clear();
        moreList.add("回复");
        if (model.getIslike().equals("0")){
            moreList.add("笔芯");
        }
        if (model.getIscollect().equals("0")){
            moreList.add("收藏");
        }
        moreList.add("复制");
        if (CommonUtils.isLogin() == true){
            if (CustomApplication.loginModel.getUid().equals(model.getUserid()) || CustomApplication.loginModel.getUid().equals(langInfoModel.getUserid())){
                moreList.add("删除");
            }
        }
        moreList.add("举报");

        ActionSheetDialog actionSheetDialog = new ActionSheetDialog(LangDetailActivity.this)
                .builder()
                .setTitle("请选择")
                .setCancelable(false)
                .setCanceledOnTouchOutside(true);
        for (String s : moreList){
            actionSheetDialog.addSheetItem(s, null, new ActionSheetDialog.OnSheetItemClickListener() {
                @Override
                public void onClick(int which) {
                    if (which > 0){
                        String title = moreList.get(which-1);
                        if (title.equals("回复")){
                            commentReply(index,true);
                        }else if (title.equals("笔芯")){
                            commentLike(index);
                        }else if (title.equals("收藏")){
                            commentCollect(index);
                        }else if (title.equals("删除")){

                            CustomDialog dialog = null;
                            final CustomDialog.Builder builder = new CustomDialog.Builder(LangDetailActivity.this);
                            builder.setTitle("温馨提示");
                            builder.setMessage("确定要删除？");
                            builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    commentDelete(index);
                                }
                            });
                            builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            });
                            dialog = builder.create();
                            dialog.show();

                        }else if (title.equals("复制")){
                            onClickCopy(model.getContent(), false);
                        }else if (title.equals("举报")){
                             report(model.getCommentid(), 3);
                        }
                    }
                }
            });
        }
        actionSheetDialog.show();
    }

    //评论笔芯
    private void commentLike(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        final DryCommentModel model = list.get(index);
        if(CommonUtils.isEmpty(model.getCommentid())){
            return;
        }
        int count = Integer.valueOf(model.getLcount());
        if (model.getIslike().equals("1")){
            if (count > 0){
                count -= 1;
            }
            model.setIslike("0");
        }else {
            count += 1;
            model.setIslike("1");
        }
        model.setLcount(count+"");
        list.set(index,model);
        //adapter.notifyItemChanged(index);
        adapter.notifyDataSetChanged();

        final Map<String,String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey,CustomApplication.loginModel.getToken());
        map.put(APIKey.idKey,model.getCommentid());
        String url = "miniapp/"+"langappid"+"/langlikecomment.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //评论收藏
    private void commentCollect(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        final DryCommentModel model = list.get(index);
        if(CommonUtils.isEmpty(model.getCommentid())){
            return;
        }
        if (model.getIscollect().equals("1")){
            model.setIscollect("0");
            model.setCollectcount(Integer.valueOf(model.getCollectcount())-1+"");
        }else {
            model.setIscollect("1");
            model.setCollectcount(Integer.valueOf(model.getCollectcount())+1+"");
        }
        adapter.notifyDataSetChanged();
        //adapter.notifyItemChanged(index);

        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("sourceid", model.getCommentid());
        map.put(APIKey.typeKey,"0");
        String url = "miniapp/"+"langappid"+"/addcollection.do";
        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
                Log.e("TAG","收藏结果："+data);
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //评论删除
    private void commentDelete(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        final DryCommentModel model = list.get(index);
        if(CommonUtils.isEmpty(model.getCommentid())){
            return;
        }

        final HashMap<String, String> map = new HashMap<String, String>();
        map.put(APIKey.tokenKey, CustomApplication.loginModel.getToken());
        map.put("id", model.getCommentid());
        map.put(APIKey.typeKey,"0");
        String url = "miniapp/"+"langappid"+"/deletecomment.do";

        list.remove(model);
        adapter.notifyDataSetChanged();

        HttpsUtils.miniAppDo(map, url, new HttpCallBack() {
            @Override
            public void onSuccess(String data) {
                Log.e("TAG","删除结果："+data);
                langInfoModel.setCommentcount(langInfoModel.getCommentcount() - 1);
                if (langInfoModel.getCommentcount() < 0) {
                    langInfoModel.setCommentcount(0);
                }
                //initLang();
                updateUI();
            }

            @Override
            public void onError(String msg) {
            }
        });
    }

    //评论分享
    private void commentShare(final int index){
        if (list == null || list.size() == 0){
            return;
        }
        final DryCommentModel model = list.get(index);
        shareType = 0;
        opIndex = index;

        final ShareDialog shareDialog = new ShareDialog(LangDetailActivity.this)
                .builder()
                .setCancelable(false)
                .setCanceledOnTouchOutside(true);
        shareDialog.friend_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //分享到朋友圈
                shareToWX(0,model.getContent());
            }
        });
        shareDialog.wx_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //分享给微信好友
                shareToWX(1,model.getContent());
            }
        });
        shareDialog.wb_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //微博
                CustomApplication.WbShareType = 0;
                CustomApplication.WbShareSourceId = model.getCommentid();
                CustomApplication.WbShareText = model.getContent();;
                Intent mIntent = new Intent(BroadcastDefine.WeiBo_Share_Action);
                //发送广播
                sendBroadcast(mIntent);
            }
        });
        shareDialog.qq_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //分享到qq
                shareToQQ(0,model.getContent(),"【微句评论】");
            }
        });
        shareDialog.zone_share.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                shareDialog.dialog.dismiss();
                //qq空间
                shareToQQ(1,model.getContent(),"【微句评论】");
            }
        });
        shareDialog.show();

    }

    //评论回复
    private void commentReply(final int index, boolean isReply){
        if (list == null || list.size() == 0){
            return;
        }
        DryCommentModel model = list.get(index);
        if (!CommonUtils.isEmpty(model.getCommentid())){
            Intent intent = new Intent(LangDetailActivity.this,LangCommentActivity.class);
            intent.putExtra("id",langInfoModel.getLangid());
            Bundle bundle = new Bundle();
            bundle.putSerializable("DryCommentModel", model);
            intent.putExtras(bundle);
            intent.putExtra("isReply",isReply);
            startActivity(intent);
        }
    }

    /****************评论******************/


    //下载分享图片
    private class getImageCacheAsyncTask extends AsyncTask<String, Void, File> {
        private final Context context;

        public getImageCacheAsyncTask(Context context) {
            this.context = context;
        }

        @Override
        protected File doInBackground(String... params) {
            String imgUrl =  params[0];
            try {
                return Glide.with(context)
                        .load(imgUrl)
                        .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
                        .get();
            } catch (Exception ex) {
                return null;
            }
        }

        @Override
        protected void onPostExecute(File result) {
            if (result == null) {
                return;
            }
            //此path就是对应文件的缓存路径
            String path = result.getPath();
            Log.e("path", path);
            Bitmap bmp= BitmapFactory.decodeFile(path);
            //0-朋友圈 1-微信 2-QQ 3-QQ空间 4-微博
            if (shareType == 0){
                shareImg2Wx(0, "微句-言微句美，发现共鸣", bmp);
            }else if (shareType == 1){
                shareImg2Wx(1, "微句-言微句美，发现共鸣", bmp);
            }else if (shareType == 2){
                shareImgToQQ(0,"微句-言微句美，发现共鸣",bmp, path);
            }else if (shareType == 3){
                shareImgToQQ(1,"微句-言微句美，发现共鸣",bmp, path);
            }else if (shareType == 4){
                CustomApplication.WbShareType = 1;
                CustomApplication.WbShareSourceId = langInfoModel.getLangid();
                CustomApplication.WbShareText = CommonUtils.formatString(langInfoModel.getTitle());
                CustomApplication.wbHasImage = true;
                CustomApplication.wbShareBitmap = bmp;
                Intent mIntent = new Intent(BroadcastDefine.WeiBo_Share_Action);
                //发送广播
                sendBroadcast(mIntent);
            }
        }
    }

    // 保存图片到手机
    public void download(final String url) {

        new AsyncTask<Void, Integer, File>() {

            @Override
            protected File doInBackground(Void... params) {
                File file = null;
                try {
                    FutureTarget<File> future = Glide
                            .with(LangDetailActivity.this)
                            .load(url)
                            .downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);

                    file = future.get();

                    // 首先保存图片
                    File pictureFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsoluteFile();

                    File appDir = new File(pictureFolder ,"Camera");
                    if (!appDir.exists()) {
                        appDir.mkdirs();
                    }
                    fileName = System.currentTimeMillis() + ".jpg";
                    File destFile = new File(appDir, fileName);

                    fileName = destFile.getPath();

                    FileUtil.copy(file.getPath(), destFile.getPath());

                    // 最后通知图库更新
                    sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
                            Uri.fromFile(new File(destFile.getPath()))));


                } catch (Exception e) {
                    Log.e(TAG, e.getMessage());
                }
                return file;
            }

            @Override
            protected void onPostExecute(File file) {
                //Log.e("TAG","图片路径："+file.getPath());
                //Toast.makeText(LangDetailActivity.this, fileName, Toast.LENGTH_LONG).show();
                Bitmap bmp= BitmapFactory.decodeFile(file.getPath());
                if (shareType == 2){
                    shareImgToQQ(0,"微句-言微句美，发现共鸣",bmp, fileName);
                }else if (shareType == 3){
                    shareImgToQQ(1,"微句-言微句美，发现共鸣",bmp, fileName);
                }
            }

            @Override
            protected void onProgressUpdate(Integer... values) {
                super.onProgressUpdate(values);
            }
        }.execute();
    }

    private void report(String reportId, int reportType){//reportType:1-举报人；2-举报微句；3-举报评论
        if (CommonUtils.isLogin() == false){
            Intent intent = new Intent(LangDetailActivity.this,LoginActivity.class);
            startActivity(intent);
            return;
        }
        Intent intent = new Intent(LangDetailActivity.this, ReportActivity.class);
        intent.putExtra(APIKey.idKey,reportId);
        intent.putExtra(APIKey.typeKey,reportType);
        startActivity(intent);
    }

    /*
    //以下是用的recycleview替代listview提高性能
    private class CommentRecyclerAdapter extends RecyclerView.Adapter<CommentRecyclerAdapter.ViewHolder>{

        public CommentRecyclerAdapter(){

        }

         class ViewHolder extends RecyclerView.ViewHolder{

            private ImageView drycomment_listview_item_header;
            private ImageView drycomment_listview_private_icon;
            private TextView drycomment_listview_item_name;
            private TextView drycomment_listview_item_time;
            private TextView drycomment_listview_item_content;

            private RelativeLayout drycomment_listview_item_reply;
            private TextView reply_text;
            private TextView replycount_text;

            private FrameLayout drycomment_listview_item_more;

            private RelativeLayout lang_like;
            private ImageView lang_like_img;
            private TextView lang_like_text;

            private RelativeLayout lang_collect;
            private ImageView lang_collect_img;
            private TextView lang_collect_text;

            private RelativeLayout comment_layout;
            private LinearLayout item_gas_line;

            public ViewHolder(View view){
                super(view);

                drycomment_listview_item_header = (ImageView) view.findViewById(R.id.drycomment_listview_item_header);
                drycomment_listview_private_icon = (ImageView) view.findViewById(R.id.drycomment_listview_private_icon);
                drycomment_listview_item_name = (TextView) view.findViewById(R.id.drycomment_listview_item_name);
                drycomment_listview_item_time = (TextView) view.findViewById(R.id.drycomment_listview_item_time);
                drycomment_listview_item_content = (TextView) view.findViewById(R.id.drycomment_listview_item_content);

                drycomment_listview_item_reply = (RelativeLayout) view.findViewById(R.id.drycomment_listview_item_reply);
                reply_text = (TextView) view.findViewById(R.id.reply_text);
                replycount_text = (TextView) view.findViewById(R.id.replycount_text);

                drycomment_listview_item_more = (FrameLayout) view.findViewById(R.id.drycomment_listview_item_more);

                lang_like = (RelativeLayout) view.findViewById(R.id.lang_like);
                lang_like_img = (ImageView) view.findViewById(R.id.lang_like_img);
                lang_like_text = (TextView) view.findViewById(R.id.lang_like_text);

                lang_collect = (RelativeLayout) view.findViewById(R.id.lang_collect);
                lang_collect_img = (ImageView) view.findViewById(R.id.lang_collect_img);
                lang_collect_text = (TextView) view.findViewById(R.id.lang_collect_text);

                comment_layout = (RelativeLayout) view.findViewById(R.id.comment_layout);

                item_gas_line = (LinearLayout) view.findViewById(R.id.item_gas_line);

            }

        }


        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.comment_listview_item,parent,false);
            ViewHolder holder = new ViewHolder(view);
            return holder;
        }

        @Override
        public void onBindViewHolder(ViewHolder holder, int position)
        {
            Log.e("TAG", "position="+position);
            DryCommentModel model = list.get(position);

            holder.comment_layout.setBackgroundColor(AppThemeUtils.getInstance().getMainColor());
            holder.comment_layout.setTag(position);
            holder.comment_layout.setClickable(true);
            holder.comment_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    commentMore((Integer) view.getTag());
                }
            });
            holder.item_gas_line.setBackgroundColor(AppThemeUtils.getInstance().getBackgroundColor());

            holder.drycomment_listview_item_header.setClickable(true);
            holder.drycomment_listview_item_header.setTag(position);
            holder.drycomment_listview_item_header.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentUser((Integer) v.getTag());
                }
            });

            holder.drycomment_listview_private_icon.setClickable(true);
            holder.drycomment_listview_private_icon.setTag(position);
            holder.drycomment_listview_private_icon.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentUser((Integer) v.getTag());
                }
            });

            holder.drycomment_listview_item_name.setClickable(true);
            holder.drycomment_listview_item_name.setTag(position);
            holder.drycomment_listview_item_name.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentUser((Integer) v.getTag());
                }
            });

            holder.drycomment_listview_item_more.setClickable(true);
            holder.drycomment_listview_item_more.setTag(position);
            holder.drycomment_listview_item_more.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentMore((Integer) v.getTag());
                }
            });

            holder.drycomment_listview_item_reply.setBackgroundResource(AppThemeUtils.getInstance().getCommentButtonBackground());
            holder.drycomment_listview_item_reply.setClickable(true);
            holder.drycomment_listview_item_reply.setTag(position);
            holder.drycomment_listview_item_reply.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentReply((Integer) v.getTag(), true);
                }
            });

            holder.reply_text.setText("回复");

            holder.replycount_text.setTag(position);
            int count = Integer.valueOf(model.getCcount());// + model.getReplycount();
            if (count > 0){
                holder.replycount_text.setVisibility(View.VISIBLE);
                holder.replycount_text.setText("查看"+count+"条回复 >");
            }else {
                holder.replycount_text.setVisibility(View.INVISIBLE);
            }
            holder.replycount_text.setClickable(true);
            holder.replycount_text.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    commentReply((int)view.getTag(), false);
                }
            });

            holder.lang_like.setVisibility(View.VISIBLE);
            holder.lang_like.setTag(position);
            holder.lang_like.setFocusable(false);
            holder.lang_like.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentLike((Integer) v.getTag());
                }
            });

            if (model.getIslike().equals("1")){
                holder.lang_like_img.setImageResource(R.drawable.workgroup_img_like_sel);
                holder.lang_like_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
            }else {
                holder.lang_like_img.setImageResource(R.drawable.workgroup_img_like);
                holder.lang_like_text.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.defaultSmallFontColor));
            }
            if (ConvertUtility.parseInt(model.getLcount()) < 1) {
                holder.lang_like_text.setText("笔芯");
            } else {
                holder.lang_like_text.setText(model.getLcount());
            }

            holder.lang_collect.setVisibility(View.VISIBLE);
            holder.lang_collect.setTag(position);
            holder.lang_collect.setFocusable(false);
            holder.lang_collect.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    commentCollect((Integer) v.getTag());
                }
            });
            ImageView collect_icon = holder.lang_collect_img;
            TextView collect_count = holder.lang_collect_text;
            if (model.getIscollect().equals("1")){
                collect_icon.setImageResource(R.drawable.collection_sel);
                collect_count.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.lightGreenColor));
            }else {
                collect_icon.setImageResource(R.drawable.collection);
                collect_count.setTextColor(ContextCompat.getColor(LangDetailActivity.this,R.color.defaultSmallFontColor));
            }
            collect_count.setText(ConvertUtility.parseInt(model.getCollectcount()) < 1 ? "收藏" : model.getCollectcount());

            Glide.with(LangDetailActivity.this).load(model.getHeader()).transform(new CircleTransform(LangDetailActivity.this)).dontAnimate().into(holder.drycomment_listview_item_header);
            if (!CommonUtils.isEmpty(model.getPrivateIcon())){
                holder.drycomment_listview_private_icon.setVisibility(View.VISIBLE);
                Glide.with(LangDetailActivity.this).load(model.getPrivateIcon()).transform(new CircleTransform(LangDetailActivity.this)).dontAnimate().into(holder.drycomment_listview_private_icon);
            }else {
                holder.drycomment_listview_private_icon.setVisibility(View.INVISIBLE);
            }

            String lcount = CommonUtils.getDisplayCount(Integer.valueOf(model.getLcount()));
            String s1 = DateUtil.getChatDate(Long.valueOf(model.getTime()))+"";
            holder.drycomment_listview_item_time.setText(s1);
            if (langInfoModel.getUserid().equals(model.getUserid())){
                holder.drycomment_listview_item_time.setText("作者  ·  "+s1);
            }

            holder.drycomment_listview_item_time.setTag(position);
            holder.drycomment_listview_item_time.setFocusable(false);


            holder.drycomment_listview_item_name.setText(model.getNickname());
            holder.drycomment_listview_item_content.setTag(position);
            holder.drycomment_listview_item_content.setText(model.getContent());
            holder.drycomment_listview_item_content.setFocusable(false);

            holder.drycomment_listview_item_name.setTextColor(AppThemeUtils.getInstance().getUserNameColorOfWeiJu());
            holder.drycomment_listview_item_content.setTextColor(AppThemeUtils.getInstance().getTextColorOfWeiJu());
            holder.drycomment_listview_item_content.setTag(position);
            holder.drycomment_listview_item_content.setClickable(true);
            holder.drycomment_listview_item_content.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    commentMore((Integer) view.getTag());
                }
            });

        }

        @Override
        public int getItemCount() {
            return list.size();
        }
    }
    */
    //com.zhongshengnetwork.rightbe.common.customview.SelfListView

}
